With a Linux based solution I decided to bite the bullet and figure out how to configure a RAID5 array out of the three. This reduces my over all available capacity, but should still prove sufficient. Besides, I have one USB port left for an additional drive for non-redundant bulk storage.
To do so I followed the instructions from the following site with only slight modifcation.
http://dtbaker.com.au/random-bits/ubuntu---howto-easily-setup-raid-5-with-lvm.html
To summarize my personal steps:
- $ tail -f /var/log/syslog
- Connect drive 1, note device reported by syslog (should be sdb)
- Connect drive 2, note device reported by syslog (should be sdc)
- Connect drive 3, note device reported by syslog (should be sdd)
- Label all 3 drives for future reference
- $ sudo apt-get install mdadm smartmontools
- $ sudo nano /etc/defaults/smartmontools
- uncomment the "start_smartd=yes" line. I'm not sure if smartmontools will work with usb hard drives, but it's worth a shot
- $ sudo nano /etc/smartd.conf
- Add one line for each new drive:
/dev/sdb -a -I 194 -W 4,45,55 -R 5
/dev/sdc -a -I 194 -W 4,45,55 -R 5
/dev/sdd -a -I 194 -W 4,45,55 -R 5 - Since my disks were already partitioned I needed to first delete the existing NTFS partitions and recreate them as Linux raid partitions. Note: be sure to evacuate the data from the disks before you repartition with fdisk! You will lose data. Thankfully I had a couple of spare drives from work that I could dump data on temporarily.
- $ sudo fdisk /dev/sdb
- In fdisk, the command sequence was "d n p 1 (default start) (default end) t fd w" This is short for delete current partition (only 1 in my case), create new partition, primary, id=1, use all space, change type to Linux RAID Autodetect, write partition table and exit.
- Use mdadm to create the RAID5 virtual device
$ sudo mdadm --create /dev/md0 --level=5 -n 3 /dev/sdb1 /dev/sdc1 /dev/sdd1 - Read the description of all running raid instances using mdadm
$ sudo mdadm --detail --scan
This will return an output like:
ARRAY /dev/md0 level=raid5 num-devices=3 metadata=00.90 spares=1
UUID=b144b150:b3b4ff34:2bababc5:c86c0f3a - Copy and paste that information into /etc/mdadm/mdadm.conf
- Initilize md0 for LVM
$ sudo pvcreate /dev/md0 - Create a volume group
$ sudo vgcreate vg1 /dev/md0 - Before we can create a logical volume that can be mounted, we need to know the available space in the array
$ sudo vgdisplay vg1 | grep "Total PE"
Total PE 476932 - Now create the logical volume
$ sudo lvcreate -l 476932 -n -lv1 vg1 /dev/md0
Logical volume "lv1" created - Format the logical volume with the file system of choice. I opted to use ext4 since that's what ubuntu chose for /
$ sudo mkfs.ext4 /dev/vg1/lv1 - Make a mount point
$ sudo mkdir /data/external - Add an entry to fstab
$ sudo nano /etc/fstab
/dev/mapper/vg1-lv1 /data/external ext4 errors=remote-ro 0 1 - Mount the new volume and verify
$ sudo mount -a
$ df -h
/dev/mapper/vg1-lv1 1.9T 28G 1.7T 2% /data/external
No comments:
Post a Comment