AffineConnection, (edited )

That’s simple, but it’s a completely unnecessary waste of I/O. You could create a writable snapshot of the btrfs root as a subvolume, edit the fstab and any other relevant files within that new subvolume, reconfigure the bootloader to specify that subvolume as the root filesystem (as a Linux kernel command line argument) instead of the btrfs root, and then reboot. After rebooting, the original btrfs root can be mounted, and everything unwanted from the original root (other than the new subvolume and its ancestor directories, obviously) can be deleted. Do not delete anything that you didn’t want to lose the changes to on the original root subvolume that you did after creating the snapshot, as the snapshot only remembers what you did before, as well as the changes made specific only to it (like the fstab).

If one wanted to create multiple subvolumes for different purposes, the above procedure can be modified. For instance, if one wanted a separate subvolume mounted at / vs /home, then one can create two writable snapshots, empty out the contents of home in new subvolume 1 (but not the /home directory itself because you want the directory to exist for something to mount onto it), empty out everything outside of home within new subvolume 2, move the contents of home therein up one directory and remove the /home directory itself. Now, one can edit the fstab in new subvolume 1 as appropriate (not forgetting to have new subvolume 2 mount at /home), edit any other relevant files, reconfigure the bootloader to tell the Linux to use new subvolume 1 as the root subvolume, then reboot. Finally, one can remove the unnecessary files from the original root.


Edit:

It is arguably better to manually specify the new root when booting in the Linux kernel command line, and not reconfigure the bootloader until you successfully boot. After success, (if the following is relevant to your system) use update-grub, and it should look at fstab to automatically reconfigure the bootloader accordingly to use the appropriate new subvolume as specified at fstab.

This is what I did years ago to one of my own systems, although I don’t know anything about Timeshift and how it requires things to be set up (I have my own backup scripts that are run by cron). I could have just snapshotted the btrfs root directly for snapshots, but I wanted the snapshots to be cleanly separated from the subvolume used as the Linux VFS root (except when I explicitly mount them).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linuxmemes@lemmy.world
  • kavyap
  • thenastyranch
  • ethstaker
  • DreamBathrooms
  • osvaldo12
  • magazineikmin
  • tacticalgear
  • Youngstown
  • everett
  • mdbf
  • slotface
  • ngwrru68w68
  • rosin
  • Durango
  • JUstTest
  • InstantRegret
  • GTA5RPClips
  • tester
  • cubers
  • cisconetworking
  • normalnudes
  • khanakhh
  • modclub
  • anitta
  • Leos
  • megavids
  • provamag3
  • lostlight
  • All magazines