Moving Homes
I put an extra SSD in my computer and moved $HOME onto it. It went surprisingly smoothly, thanks to btrfs, and I’m writing it down here for Future Sean, because that guy can’t remember anything.
Here were the basic steps: first, make the destination partition on the drive.
In my case, this was /dev/sda1
.
Then do some btrfs magic:
mkfs.btrfs -L drivelabel /dev/sda1
mkdir /media/drivelabel
mount -t btrfs /dev/sda1 /media/drivelabel
btrfs subvolume snapshot -r /media/home
btrfs send /media/home | btrfs receive /media/drivelabel
btrfs property set -f /media/drivelabel/home ro false
That last point bit me and required a couple of extra reboots.
I had read about it, but it got lost in all the moving around.
Finally, update /etc/fstab
to mount the new subvolume.
This can be with the label using the LABEL=
argument, but for the UUID, call blkid -s UUID /dev/sda1
.
Don’t forget the subvolume:
UUID=bff4d27c-3fce-4d75-8b08-420b29fe50b8 /home btrfs subvol=/home,defaults,noatime,compress=zstd 0 0
Reboot, and Bob’s your uncle.
The part I haven’t gotten around to is deleting the old /@home
and snapshot.
Mainly, because that disk is only 17% full, and I don’t need the space, and it makes me feel a little better having it around.
The only thing I lost through this was a little time, and about a dozen lines in my zsh history after the snapshot.
In oelden days, I’d have rsync’d home, but thar be monsters. It’s easily to do wrong. The Mistakes I made during this process only resulted in a couple of extra reboots, which was an improvement.
Oh: once you do that force-set of the write bit on the snapshot copy, it (apparently) breaks the link.