Home server HDD upgrade

Home server HDD upgrade

It’s been 1,5 year since I build a new home server. I’m quite happy with this system, but lately I am running out of hard disk space. This is mainly caused by HD movie editing which I’m recently into. That’s why I bought two new 2 TB hard disks (WD20EARS) today to replace the current 1 TB ones (WD10EVVS).

I’ve done my hard disk setup with Linux soft raid 1 (mirror). So the plan is to break the mirror switch one pair of disks, rebuild the mirror and repeat this for the other pair.

It essentially comes down to the following commands having two disks, sda and sdb, both with two partitions.

Break the mirror:

# mdadm /dev/md0 --set-faulty /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
# mdadm /dev/md0 --remove /dev/sdb1
mdadm: hot removed /dev/sdb1
# mdadm /dev/md1 --set-faulty /dev/sdb2
mdadm: set /dev/sdb2 faulty in /dev/md0
# mdadm /dev/md1 --remove /dev/sdb2
mdadm: hot removed /dev/sdb2

Shutdown the system, and swap disks. Be sure to swap the correct disk, the one that have been removed from the mirror.

Power on the system and partition the newly added disk. This is where I had to pay attention. It appears the new Western Digital disks are 4096-byte per sector disks instead of the traditional 512-byte sector disks. In order to have good performing disks I had to correct the alignment of the new disk. This covered in greater detail on this page.

Partition the disks (ensure that you’re root filesystem is bootable).

Add the new disk to the mirror and watch the sync progress:

# mdadm /dev/md0 --add /dev/sdb1
# watch cat /proc/mdstat
# mdadm /dev/md1 --add /dev/sdb2
# watch cat /proc/mdstat

Install grub on the new disk and repeat the above steps for the other disk.

After the sync is completed run the grow command:

# mdadm /dev/md1 --grow --size=max

Finishing steps:

# pvresize --verbose /dev/md0
# lvresize --verbose -L <SIZE> /dev/mapper/VG-LV
# resize2fs /dev/mapper/VG-LV