My old dual 300GB ATA mirrored disks were becoming full and the pains of having low disk space were becoming too much of a strain, it was time to get some bigger disks...
This article explains the procedures required in FreeBSD to install and partition the new disks as well as migrating the data from the older disks using RSYNC.
My current configuration:
Filesystem Size Used Avail Capacity Mounted on /dev/ad8s1c 3.0G 290M 2.5G 10% / devfs 1.0K 1.0K 0B 100% /dev /dev/ad8s3c 446G 405G 5.7G 99% /usr procfs 4.0K 4.0K 0B 100% /proc /dev/ad10.eli 458G 412G 9.6G 98% /mnt/backup /dev/ad0.eli 275G 252G 895M 100% /mnt/300gb_primary /dev/ad1.eli 275G 228G 25G 90% /mnt/300gb_backup
Unfortunately the two 300GB drives are ATA which is now an old technology, since I was taking a plunge I may aswell move to something better while I'm making the change at all.
Required Hardware
A quick look on Komplett (whom I whole heartedly recommend) and 2 x Samsung spinpoint 500GB SATA disks were purchased on special for only €144.
Two SATA cables (i just had these lying around):
And a SATA interface, or in my case a Sunsway/ST Lab PCI SATA interface because the existing 500GB's are already using up the motherboard's SATA slots.
Unfortunately I didn't fully investigate what was required and upon inspection I discovered I needed more SATA power connectors since the two existing connectors were being used, as a result the following little gadget was purchased from maplin:
Installation Procedure
The SATA PCI card was installed, the two disks attached to it via the SATA cables and the drives were powered by connecting them to the PSU via the SATA power adapters. The adapters I got from maplin had poor quality PSU connectors on them (the white ones) where the pins could move.. this made it painful to connect up since all 4 pins had to be aligned before the connector properly fit.
Everything was switched on and FreeBSD began its bootup, all drives were successfully detected as can be seen on the dmesg output:
ad0: 286168MB <WDC WD3000JB-00KFA0 08.05J08> at ata0-master UDMA100 ad1: 286168MB <WDC WD3000JB-00KFA0 08.05J08> at ata0-slave UDMA100 ad4: 476940MB <SAMSUNG HD501LJ CR100-12> at ata2-master SATA150 ad6: 476940MB <SAMSUNG HD501LJ CR100-12> at ata3-master SATA150 ad8: 476940MB <SAMSUNG HD501LJ CR100-10> at ata4-master SATA150 ad10: 476940MB <SAMSUNG HD501LJ CR100-10> at ata5-master SATA150
I use an encrypted disk configuration using GELI and so before we can use FDISK to partition the drives we must initialize disk encryption, at this point I should point out that for more details on configuring disk encryption on FreeBSD see encrypting file system partitions in FreeBSD article.
Firstly, we initialize disk encryption on the devices. Since I'm already using disk encryption we're going to use my old key for initializing the encryption. This is the same keyfile I use for all my drives:
[root@orion] (/etc): geli init -s 4096 -K /root/.geli_keys/ad1.key /dev/ad4 Enter new passphrase: Reenter new passphrase: [root@orion] (/etc): geli attach -k /root/.geli_keys/ad1.key /dev/ad4 Enter passphrase: [root@orion] (/etc): tail -3 /var/log/messages Apr 12 11:56:21 orion kernel: GEOM_ELI: Device ad4.eli created. Apr 12 11:56:21 orion kernel: GEOM_ELI: Encryption: AES-CBC 128 Apr 12 11:56:21 orion kernel: GEOM_ELI: Crypto: software
The same procedure is repeated for the ad6 disk.
When that's done we newfs the entire disks (for my needs I prefer to have one enormous slice):
[root@orion] (/etc): newfs /dev/ad4.eli > /ad4_superblocks.txt [root@orion] (/etc): newfs /dev/ad6.eli > /ad6_superblocks.txt
Note that I have redirected the newfs output to a text file since the superblock locations can be useful for disaster recovery.
Then, I enable softupdates:
[root@orion] (/etc): tunefs -n enable /dev/ad4.eli tunefs: soft updates set [root@orion] (/etc): tunefs -n enable /dev/ad6.eli tunefs: soft updates set
Now we need to mount these disks, so we create appropriately named mount points:
[root@orion] (/etc): mkdir /mnt/{500gb_primary,500gb_backup}
And now our /etc/fstab entries:
# New 500GB SATA disks /dev/ad4.eli /mnt/500gb_primary ufs rw 0 0 /dev/ad6.eli /mnt/500gb_backup ufs rw,noauto 0 0
Next we mount the drives at our mountpoints:
[root@orion] (/etc): mount /mnt/500gb_primary/ [root@orion] (/etc): mount /mnt/500gb_backup/
And just to confirm that we're looking good:
Filesystem Size Used Avail Capacity Mounted on /dev/ad8s1a 3.0G 290M 2.5G 10% / devfs 1.0K 1.0K 0B 100% /dev /dev/ad8s3c 446G 405G 5.7G 99% /usr procfs 4.0K 4.0K 0B 100% /proc /dev/ad10.eli 458G 412G 9.6G 98% /mnt/backup /dev/ad0.eli 275G 252G 895M 100% /mnt/300gb_primary /dev/ad1.eli 275G 228G 25G 90% /mnt/300gb_backup /dev/ad4.eli 458G 8.0K 422G 0% /mnt/500gb_primary /dev/ad6.eli 458G 8.0K 422G 0% /mnt/500gb_backup
Yes, truly blissful.
Anyway, the disks are now ready for use, let's migrate over all the data using RSYNC:
[root@orion] (/etc): rsync -av --progress /mnt/300gb_primary/ /mnt/500gb_primary/
For laughs this small little tcsh script helps keep an eye on the overall progress:
[jbw@orion] (~): while (1) while? clear; df -h | grep ad4 while? sleep 1 while? end /dev/ad4.eli 458G 2.9G 419G 1% /mnt/500gb_primary
Now it's coffee time since this has to copy 300GB of data so it's gonna take a little while....