Squeezebox Setup

RAIDing

The next step is to install the data drives and RAID them. As previously mentioned on top of the data drive I will have 2 1Tb western digital green drives in RAID 5. This means to start with I will have 1Tb of space, but with the potential to add extra drives to gain more space. The first step is to power down and install the two additional drives. As we installed acpid you should be able to use the power button to shutdown, but if not

[root@tranquilpc ~]# shutdown -h now

will do it. Once you have rebooted we first need to check that the drives are where expected. As the operating system drive was /dev/sda that means that the data drives should be /dev/sdb and /dev/sbc. To check you can use the fisk command.

[root@tranquilpc ~]# fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 4864 38965657+ 8e Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn’t contain a valid partition table

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn’t contain a valid partition table

The output shows two unformatted and unpartitioned drives on /dev/sdb and /dev/sdc. First we need to partition them. Using /dev/sdb as an exanple:

[root@tranquilpc ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 121601.
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
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-121601, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601):
Using default value 121601

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@tranquilpc ~]#

The sequence is to first create a new partition (n option), then change it to be part of a RAID array (t option to set partition type to fd). This process should be repeated for /dev/sdc as well. When both drives are finished fdisk -l should now show two drives ready for RAIDing:

[root@tranquilpc ~]# fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 4864 38965657+ 8e Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 fd Linux raid autodetect

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 121601 976760001 fd Linux raid autodetect

Then to RAID the two drives into RAID 5 simply use the following command

[root@tranquilpc ~]# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 976759936K
mdadm: array /dev/md0 started.

This will take several hours to run – to keep track of progress you can do:

root@tranquilpc ~]# watch cat /proc/mdstat

Every 2.0s: cat /proc/mdstat Mon Jun 8 18:30:42 2009

Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[2] sdb1[0]
976759936 blocks level 5, 64k chunk, algorithm 2 [2/1] [U_]
[>………………..] recovery = 0.3% (3228316/976759936) finish=379.6min speed=42740K/sec

unused devices: <none>

The watch command will rerun the cat every 2 seconds – so you will see the array build time tick down. Next we need a config file to store the array details to make it easier to assemble the array on a reboot:

[root@tranquilpc ~]# mkdir /etc/mdadm/
[root@tranquilpc ~]# echo "DEVICE partitions" > /etc/mdadm/mdadm.conf
[root@tranquilpc ~]# mdadm --detail --scan >> /etc/mdadm/mdadm.conf

The next post will get to formatting the drives.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.