AIM
To create a redundant array of inexpensive disk.
PROCEDURE
Step 1: Start the process by opening the terminal.
Step 2: List out all the disks available in the system using the command:
fdisk –l
Step 3: Make two partitions using the following command:
fdisk /dev/hdc
Step 4: Assign the raid hexa decimal code for the partitions.
Step 5: Again use the fdisk -l command to check whether the hexa decimal codes are assigned.
Step 6: Create the raid using the following command:
mdadm -C /dev/md0 -l 0 -n 2 /dev/hdc10 /dev/hdc11
Step 7: Format the disk using the command:
mkfs -t ext3 /dev/md0
Step 8: Mount the disk using the command:
mount /dev/md0 /mnt
Step 9: Use the following command to unmount the disk:
cd /mnt
Step10: Use the df command to view the disk space.
Step11: Make the copy of the data from one disk to another disk using the command:
cp -r /dev/hdc10 /dev/hdc11 /mnt
Step12: Unmount the disks and use the below command to stop the md0:
mdadm --stop /dev/md0
Step13: Finally remove md0 by using the following command:
mdadm --remove /dev/md0
Step14: Delete the created partitions using the fdisk /dev/hdc command .
Step15: Stop the process.
COMMANDS
1) List the disks
[root@lab15-33 ~]# fdisk -l
Disk /dev/hdc: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1275 10241406 83 Linux
/dev/hdc2 1276 2550 10241437+ 83 Linux
/dev/hdc3 2551 3825 10241437+ 83 Linux
/dev/hdc4 3826 4865 8353800 5 Extended
/dev/hdc5 3826 4718 7172991 83 Linux
/dev/hdc6 4719 4730 96358+ 83 Linux
/dev/hdc7 4731 4831 811251 83 Linux
/dev/hdc8 4832 4837 48163+ fd Linux raid autodetect
/dev/hdc9 4838 4841 32098+ fd Linux raid autodetect
2) Making disk partitions
[root@lab15-33 ~]# fdisk /dev/hdc
The number of cylinders for this disk is set to 4865.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
First cylinder (4842-4865, default 4842): 4842
Last cylinder or +size or +sizeM or +sizeK (4842-4865, default 4865): +5
Command (m for help): n
First cylinder (4848-4865, default 4848): 4848
Last cylinder or +size or +sizeM or +sizeK (4848-4865, default 4865): +5
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab15-33 ~]# partprobe
3) Assigning raid hexa decimal code
[root@lab15-33 ~]# fdisk /dev/hdc
The number of cylinders for this disk is set to 4865.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): t
Partition number (1-11): 11
Hex code (type L to list codes): l
0 Empty 1c Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden W95 FAT1 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32M 3c PartitionMagic 82 Linux swap c6 DRDOS/sec (FAT-
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b W95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c W95 FAT32 (LBA) 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e W95 FAT16 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
f W95 Ext'd (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden W95 FAT3 65 Novell Netware b8 BSDI swap ff BBT
Hex code (type L to list codes): fd
Changed system type of partition 11 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-11): 10
Hex code (type L to list codes): l
0 Empty 1c Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden W95 FAT1 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32M 3c PartitionMagic 82 Linux swap c6 DRDOS/sec (FAT-
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b W95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c W95 FAT32 (LBA) 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e W95 FAT16 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
f W95 Ext'd (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden W95 FAT3 65 Novell Netware b8 BSDI swap ff BBT
Hex code (type L to list codes): fd
Changed system type of partition 10 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@lab15-33 ~]# partprobe
4) Check for the assigned hexa decimal code
[root@lab15-33 ~]# fdisk -l
Disk /dev/hdc: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1275 10241406 83 Linux
/dev/hdc2 1276 2550 10241437+ 83 Linux
/dev/hdc3 2551 3825 10241437+ 83 Linux
/dev/hdc4 3826 4865 8353800 5 Extended
/dev/hdc5 3826 4718 7172991 83 Linux
/dev/hdc6 4719 4730 96358+ 83 Linux
/dev/hdc7 4731 4831 811251 83 Linux
/dev/hdc8 4832 4837 48163+ fd Linux raid autodetect
/dev/hdc9 4838 4841 32098+ fd Linux raid autodetect
/dev/hdc10 4842 4847 48163+ fd Linux raid autodetect
/dev/hdc11 4848 4853 48163+ fd Linux raid autodetect
5) Creating raid
[root@lab15-33 ~]# mdadm -C /dev/md0 -l 0 -n 2 /dev/hdc10 /dev/hdc11
mdadm: array /dev/md0 started.
6) Displaying partition numbers
[root@lab15-33 ~]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 hdc11[1] hdc10[0]
96128 blocks 64k chunks
unused devices: <none>
[root@lab15-33 ~]# mkfs -t ext3 /dev/md0
mke2fs 1.35 (28-Feb-2004)
max_blocks 98435072, rsv_groups = 12016, rsv_gdb = 256
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
24096 inodes, 96128 blocks
4806 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
12 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
inode.i_blocks = 3074, i_size = 67383296
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
7) Mounting the disks
[root@lab15-33 ~]# mount /dev/md0 /mnt
8) Unmounting the disks
[root@lab15-33 ~]# cd /mnt
9) Showing the disk space
[root@lab15-33 mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdc3 10080520 6188712 3379740 65% /
/dev/hdc1 10080488 58280 9510140 1% /boot
none 253996 0 253996 0% /dev/shm
/dev/hdc2 10080520 56472 9511980 1% /home
/dev/hdc5 7060276 191180 6510448 3% /var
/dev/md0 93079 5664 82609 7% /mnt
10) Mirroring
[root@lab15-33 mnt]# cp -r /dev/hdc10 /dev/hdc11 /mnt
11) List out the partitions
[root@lab15-33 mnt]# ls
hdc10 hdc11 lost+found
12) Coming out of the mount directory
[root@lab15-33 mnt]# cd ..
13) Mounting
[root@lab15-33 /]# umount /mnt
14) Stopping the md0
[root@lab15-33 /]# mdadm --stop /dev/md0
15) Removing the md0
[root@lab15-33 /]# mdadm --remove /dev/md0
16) Deleting the created partitions
[root@lab15-33 /]# fdisk /dev/hdc
The number of cylinders for this disk is set to 4865.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Partition number (1-11): 10
Command (m for help): d
Partition number (1-10): 11
Value out of range.
Partition number (1-10): 9
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
0 comments:
Post a Comment