Switching filesystems in Arch Linux
So you wanna jump from one moving train to another for fun?
You could just do a fresh install. Or you could try this. Basically we're going to reinstall your base system, then restore all your old files over the top. This means you can avoid reinstalling all your old programs and settings etc.
After many failed attempts, this is what worked for me. Recording it here for future reference and in case it's useful for anyone else. (In my case I was going from f2fs to btrfs btw.)
The main issue is making sure you don't overwrite the new /etc/fstab
with your old one, otherwise you'll end up with a system that won't boot because it will be looking for your old filesystems.
Here's what you do.
Make a full system backup with something like Rescuezilla for if when you screw up your system and need to restore it.
Make a backup on an external drive of all your files. I used Timeshift with the RSYNC option.
Reinstall Arch on your main drive, and choose the filesystem you want to switch to.
Make sure the new system boots.
Then we're going to boot into the System Rescue CD and mount the new system drive and the old Timeshift backup.
Use lsblk
to get your device names and replace them in the code below eg. nvme0n1p2
and sda1
.
(Replace filesystems and drive names with your own.)
Make a backup of the new fstab
file.
Now we're going to copy the old Timeshift backup files to the new system.
I did this one directory at a time, just to be sure, starting with /home
, then rebooting, then repeating the process with /usr
, /var
, and /root
and the others and finally /etc
.
For example:
Replace the directory names with your own. (btrfs is a bit strange as it uses @ to denote subvolumes.)
If I remember correctly, I think I had to use the --ignore-times
option for the /etc
directory. This forces files to be overwritten, even if they're older. There was a little guesswork involved in this process and I want to go back over it sometime.
In the end, you'll want to restore the fstab
backup file.
Then reboot. And hopefully you now have a working system.
If not, restore from your Rescuezilla backup and try, try again.
Good luck!
UPDATE-2023-12-27
I tried the process again and didn't seem to need --ignore-times
this time. Also because Arch maps the @log/
subvolume to /var/log
I removed the contents of @/var/log/
after I rsynced it over.