#How can I use btrfs to make snapshots for my applications?

20 messages · Page 1 of 1 (latest)

humble canopy
#

I want to switch my current distro to it's testing branch, but before I do that I would like to back up all of my programs in case something goes terribly wrong. How can I set up a subvolume to contain program files that I can restore if something goes haywire? I've looked things up but I'm not entirely sure what the course of action is, sorry

#

aka basically just make a subvolume for /bin (or /) but I don't know how to do that after the fact

frail gazelle
#

$ btrfs subvolume snapshot --help
cd to wherever you want the new subvol to be; if your / is a subvolume (not the root one) then you may want to mount the root subvol and cd to it.
sudo btfrs snapshot create <the subvolume to snapshot> <name of the snapshot> (or whatever you wanna name it)

humble canopy
#

what if I don't really understand how to use subvolumes

#

to me they look like virtual partitions but I don't know how to replace old stuff on my computer with subvolumes

frail gazelle
#

basically a subvolume is like a directory that you can mount as if it were a partition

#

what you want to do is create a new subvolume, and copy the contents of /bin to it
then you can mount it to /bin in /etc/fstab

#

if you create a subvolume under one that is already mounted, then you can cd into it like any other directory

#

my main disk looks like this:

ID 256 gen 104813 top level 5 path @
ID 257 gen 102113 top level 5 path @boot
ID 261 gen 104813 top level 5 path @home
ID 262 gen 47790 top level 5 path .beeshome
ID 263 gen 47618 top level 5 path @boot_snapshot_2022-08-13

so i have 5 subvolumes

#

you would do something like
cd /
sudo btrfs subvolume create @bin_backup_date
then copy the contents of /bin to /@bin

#

If your / is already on its own subvolume (you can check with sudo btrfs subvol list /), then you can just use the snapshot command i posted

humble canopy
#

ohh I see

#

thank you

final edge
#

a subvol of /usr/bin is also a bad idea

#

even for a /usr

#

cys if you restore a snapshot of root and dont restore /usr
then they dont match

if you want to downgrade an app install an older version of the package @humble canopy

humble canopy
#

well this post is marked "other distro" because it's another distro

#

I was switching to the gentoo testing branch and wanted to back up all of my packages in case the upgrade went poorly