this post was submitted on 03 Dec 2023
250 points (97.7% liked)
linuxmemes
21226 readers
89 users here now
Hint: :q!
Sister communities:
- LemmyMemes: Memes
- LemmyShitpost: Anything and everything goes.
- RISA: Star Trek memes and shitposts
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack members of the community for any reason.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
- These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudo
in Windows. - No porn. Even if you watch it on a Linux machine.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
Please report posts and comments that break these rules!
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
you can create them afterwards and move the stuff into the subvol. do it from a live usb and don't forget to update fstab. be sure to use rsync with the flag to keep permissions etc
Yeah, that should work, thanks ๐.
You're welcome
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).
you're right, this is a solution efficiently using the btrfs features. thank you