The exercise is done on RHEL5.8. Manually create 2 partitions for s/w RAID on disk /dev/sdc
# fdisk /dev/sdc Command (m for help): p Disk /dev/sdc: 146.8 GB, 146810536448 bytes 255 heads, 63 sectors/track, 17848 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-17848, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-17848, default 17848): +50000M Command (m for help): p Disk /dev/sdc: 146.8 GB, 146810536448 bytes 255 heads, 63 sectors/track, 17848 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 6080 48837599+ 83 Linux Command (m for help): t Selected partition 1 Hex code (type L to list codes): L 0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris 1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx 5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data 6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility 8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b 11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor 12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT Hex code (type L to list codes): fd Changed system type of partition 1 to fd (Linux raid autodetect) Command (m for help): p Device Boot Start End Blocks Id System /dev/sdc1 1 6080 48837599+ fd Linux raid autodetect Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (6081-17848, default 6081): Using default value 6081 Last cylinder or +size or +sizeM or +sizeK (6081-17848, default 17848): Using default value 17848 Command (m for help): p Device Boot Start End Blocks Id System /dev/sdc1 1 6080 48837599+ fd Linux raid autodetect /dev/sdc2 6081 17848 94526460 83 Linux Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): fd Changed system type of partition 2 to fd (Linux raid autodetect) Command (m for help): p Device Boot Start End Blocks Id System /dev/sdc1 1 6080 48837599+ fd Linux raid autodetect /dev/sdc2 6081 17848 94526460 fd Linux raid autodetect Command (m for help): w The partition table has been altered! Syncing disks. |
# sfdisk -d /dev/sdc | sfdisk --force /dev/sdd Checking that no-one is using this disk right now ... OK Disk /dev/sdd: 17848 cylinders, 255 heads, 63 sectors/track Old situation: Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sdd1 0 - 0 0 0 Empty /dev/sdd2 0 - 0 0 0 Empty /dev/sdd3 0 - 0 0 0 Empty /dev/sdd4 0 - 0 0 0 Empty New situation: Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sdd1 1 97675199 97675199 fd Linux raid autodetect /dev/sdd2 97675200 286728119 189052920 fd Linux raid autodetect /dev/sdd3 0 - 0 0 Empty /dev/sdd4 0 - 0 0 Empty Warning: no primary partition is marked bootable (active) This does not matter for LILO, but the DOS MBR will not boot this disk. Successfully wrote the new partition table |
# fdisk -l /dev/sdc Disk /dev/sdc: 146.8 GB, 146810536448 bytes 255 heads, 63 sectors/track, 17848 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 6080 48837599+ fd Linux raid autodetect /dev/sdc2 6081 17848 94526460 fd Linux raid autodetect # fdisk -l /dev/sdd Disk /dev/sdd: 146.8 GB, 146810536448 bytes 255 heads, 63 sectors/track, 17848 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdd1 1 6080 48837599+ fd Linux raid autodetect /dev/sdd2 6081 17848 94526460 fd Linux raid autodetect |
# mdadm -C /dev/md1 --level=raid1 --raid-devices=2 /dev/sdc1 /dev/sdd1 mdadm: array /dev/md1 started. # cat /proc/mdstat Personalities : [raid1] md1 : active raid1 sdd1[1] sdc1[0] 48837504 blocks [2/2] [UU] [===>.................] resync = 17.4% (8501120/48837504) finish=8.0min speed=83557K/sec unused devices: <none> # mdadm --detail /dev/md1 /dev/md1: Version : 0.90 Creation Time : Sat Jan 12 12:58:53 2013 Raid Level : raid1 Array Size : 48837504 (46.58 GiB 50.01 GB) Used Dev Size : 48837504 (46.58 GiB 50.01 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Sat Jan 12 12:58:53 2013 State : clean, resyncing Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Rebuild Status : 22% complete UUID : 1a7d9c76:4b7deefd:40a1bf7c:e4f324cb Events : 0.1 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 1 8 49 1 active sync /dev/sdd1 |
# cat /proc/mdstat Personalities : [raid1] md1 : active raid1 sdd1[1] sdc1[0] 48837504 blocks [2/2] [UU] # mdadm --detail /dev/md1 /dev/md1: Version : 0.90 Creation Time : Sat Jan 12 12:58:53 2013 Raid Level : raid1 Array Size : 48837504 (46.58 GiB 50.01 GB) Used Dev Size : 48837504 (46.58 GiB 50.01 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 1 Persistence : Superblock is persistent Update Time : Sat Jan 12 13:08:49 2013 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 UUID : 1a7d9c76:4b7deefd:40a1bf7c:e4f324cb Events : 0.4 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 1 8 49 1 active sync /dev/sdd1 |
# mdadm --detail --scan > /etc/mdadm/mdadm.conf # cat /etc/mdadm/mdadm.conf ARRAY /dev/md1 level=raid1 num-devices=2 metadata=0.90 UUID=bbaf65d5:c294785a:f65e03cd:7cd8fa19 |
# mdadm -S /dev/md1 mdadm: stopped /dev/md1 # cat /proc/mdstat Personalities : [raid1] unused devices: |
# mdadm -A -R /dev/md1 mdadm: /dev/md1 has been started with 2 drives. # cat /proc/mdstat Personalities : [raid1] md1 : active raid1 sdc1[0] sdd1[1] 48837504 blocks [2/2] [UU] unused devices: |
# mkfs -V -t ext3 /dev/md1 mkfs (util-linux 2.13-pre7) mkfs.ext3 /dev/md1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 6111232 inodes, 12209376 blocks 610468 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=0 373 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. |
#MD aka s/f raid /dev/md1 /raid1 ext3 defaults 1 2 |
# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 4.3G 2.0G 2.1G 49% / /dev/sda2 4.3G 181M 3.9G 5% /var /dev/sda4 55G 13G 39G 25% /.0 tmpfs 7.9G 0 7.9G 0% /dev/shm /dev/md1 46G 181M 44G 1% /raid1 |