I tried to transfer /usr
to a different drive using various methods but none seem to be working with Ubuntu (18.04.3 LTS).
What I'm trying to do is move some of the system directories that are on HDD to an SSD drive (PCI Express so connect with NVME driver). The system was installed on HDD and I don't really want to reinstall it...
Edit: Important! The problem only occurs for /usr
dir. I also did exactly the same for /var
dir and everything works fine.
I tried doing this from Rescue CD like so:
# mount root (hdd, source)
mkdir /mnt/root
mount /dev/sda2 /mnt/root
# mount faster drive (ssd, destination)
mkdir /mnt/ssd500pci
mount /dev/nvme0n1p1 /mnt/ssd500pci
# move old
mv /mnt/root/usr /mnt/root/usr.old
# copy to new location
rsync -aH --info=progress2 /mnt/root/usr.old/ /mnt/ssd500pci/usr
# create mount point
mkdir -p /mnt/root/usr
Then in fstab I have something like this:
UUID=abcdef-1 / ext4 defaults,noatime 0 0
UUID=abcdef-2 /boot/efi vfat defaults 0 0
# my ssd
UUID=abcdef-3 /mnt/ssd500pci ext4 defaults,noatime 0 0
# swap
/mnt/ssd500pci/swap.img none swap sw 0 0
# bindings
/mnt/ssd500pci/usr /usr none bind 0 0
And after reboot I get a message that makes no sense to me: "Unexpected reschedule of offline CPU#7" (see photo).
Note that when I move usr.old
back to usr
(and remove binding in fstab) then everything works fine.
PS: At first I actually tried doing this on a working system (which was supposed to work according to this answer: https://serverfault.com/a/597780/62024). The result was basically the same.
Also note that on each attempt I remove /mnt/ssd500pci/usr
and try to copy again (to make sure there are no problem with hard links or stale files).
/usr/lib
is required at boot (which seems like a Ubuntu bug to me). If I keep/usr/lib
folder then everything works even if I actually mount a usr lib over it. Go figure... – Nux Aug 23 '19 at 17:22ln -s /mnt/ssd500pci/usr/lib lib
) but that didn't help either. – Nux Aug 23 '19 at 17:34