This is another follow on from the article describing how to mirror your disks using LVM and mdadm. When it came to mirroring the swap logical volume, I found it wouldn't quite fit on the mirror disk (even though it was ostensibly the same size, it was a different manufacturer). I decided to create a new, slightly smaller swap and mirror that. The procedure does depend on you having some space to create the new swap volume (in my case, the mirror disk).

1. Create a new swap partition (I was using LVM and had space in my volume group from the mirror disk)

 lvcreate -L 7.5G -n swap_2 mint-vg
 lvdisplay -v /dev/mint-vg/swap_2

2. Remove the current swap partition

 swapon -s
 swapoff /dev/mapper/mint--vg-swap_1

3. Add the new swap partition

 mkswap /dev/mapper/mint--vg-swap_2
 swapon /dev/mapper/mint--vg-swap_2
 swapon -s

4. I could now delete the original swap logical volume and use the space to mirror the new swap partition

 lvremove /dev/mint-vg/swap_1
 lvconvert -m 1 /dev/mint-vg/swap_2 /dev/sda5
 swapon -s

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password