LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   BTRFS, subvolumes and timeshift, snapshots, how to access without GUI. (https://www.linuxquestions.org/questions/linux-newbie-8/btrfs-subvolumes-and-timeshift-snapshots-how-to-access-without-gui-4175722794/)

vieno 03-07-2023 07:54 AM

BTRFS, subvolumes and timeshift, snapshots, how to access without GUI.
 
TLDR:
Timeshift works fine (snapshots and restore from snapshots) with the btrfs option when I use the GUI, but if I can't access the GUI and need to fix my system/restore from command line how to I acess the timeshift folder with my snapshots?

Background:
I setup @ and @home on a laptop fedora installation as I wanted to use timeshift so as to benefit from snapshots. Timeshift says it saves snapshots to /timeshift-btrfs but when I $ls -la / I can't see this directory but it is in the subv list. I tried following https://fedoramagazine.org/working-w...fs-subvolumes/ but had issues with path names (think my luks encryption migth have complicated things).

Am struggling to understand btrfs subvols. Any advice and noob friendly guides/tutorials/info refs would be greatly welcomed :)

Further details:
Fedora Linux 37 (KDE Plasma) x86_64
Kernel: 6.1.14-200.fc37.x86_64
DE: Plasma 5.27.2
Theme: [Plasma], Breeze [GTK2/3]

$lsblk
```
NAME *****************************************MAJ:MIN RM **SIZE RO TYPE *MOUNTPOINTS
sda ********************************************8:0 ***1 ****0B *0 disk **
sdb ********************************************8:16 **1 ****0B *0 disk **
zram0 ****************************************252:0 ***0 ****8G *0 disk *[SWAP]
nvme1n1 **************************************259:0 ***0 953.9G *0 disk **
├─nvme1n1p1 **********************************259:2 ***0 465.7G *0 part **
└─nvme1n1p2 **********************************259:3 ***0 488.2G *0 part **
nvme0n1 **************************************259:1 ***0 **1.8T *0 disk **
├─nvme0n1p1 **********************************259:4 ***0 **600M *0 part */boot/efi
├─nvme0n1p2 **********************************259:5 ***0 ****1G *0 part */boot
└─nvme0n1p3 **********************************259:6 ***0 **1.8T *0 part **
*└─luks-dfc17fbe-52ed-4a9b-bd3c-3c8f6937f0e9 253:0 ***0 **1.8T *0 crypt /home
************************************************************************/
```

$ sudo btrfs subv list .The tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

However on my system it is:

/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears.The tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

However on my system it is:

/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears.
```
ID 256 gen 3544 top level 5 path @home
ID 257 gen 2408 top level 5 path timeshift-btrfs/snapshots/2023-03-06_13-18-12/@
ID 259 gen 2771 top level 5 path timeshift-btrfs/snapshots/2023-03-06_13-03-03/@
ID 260 gen 2766 top level 5 path timeshift-btrfs/snapshots/2023-03-06_22-21-41/@
ID 261 gen 2774 top level 5 path timeshift-btrfs/snapshots/2023-03-06_22-25-03/@
ID 262 gen 3544 top level 5 path @
```

/etc/fstab
```
UUID=9bbd4929-c483-4b94-9b9b-3eb437b4eb69 / **********************btrfs **subvol=@,compress=zstd:1,x-systemd.device-
timeout=0 0 0
UUID=e5153368-03b4-4a38-abb1-2e9fThe tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

However on my system it is:

/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears.The tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

However on my system it is:

/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears.The tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

However on my system it is:

/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears.e912eaf5 /boot ******************ext4 ***defaults ****1 2
UUID=A7F8-FD21 ***************************/boot/efi **************vfat ***umask=0077,shortname=winnt 0 2
UUID=9bbd4929-c483-4b94-9b9b-3eb437b4eb69 /home ******************btrfs **subvol=@home,compress=zstd:1,x-systemd.dev
ice-timeout=0 0 0
```

UPDATE
The online tutorials I've found and inside the software say that the path to backups is:

/run/timeshift/backup/timeshift-btrfs
or
/timeshift

Yet on my system it is:
/run/timeshift/**xxx_random_number_here_xxx**/backup/timeshift-btrfs

I noticed that the **xxx_random_number_here_xxx** changes each time timeshift is loaded and when timeshift is not running the folder completely disappears. Now unsure whether it's a timeshift thing or btrfs thing.

JJJCR 03-13-2023 04:21 AM

From this link below, i believe you will need to mount the snapshot and recover from there.

https://archive.kernel.org/oldwiki/b...html#Snapshots


Quote:

Managing Snapshots
One typical structure for managing snapshots (particularly on a system's "main" filesystem) is based on the to flat schema from above. The top-level subvolume is mostly left empty except for subvolumes. It can be mounted temporarily while subvolume operations are being done and unmounted again afterwards. Alternatively an empty "snapshot" subvolume can be created (which in turn contains the actual snapshots) and permanently mounted at a convenient directory path.

The actual structure could look like this:

toplevel (volume root directory, not mounted)
+-- root (subvolume root directory, to be mounted at /)
+-- home (subvolume root directory, to be mounted at /home)
\-- snapshots (directory)
+-- root (directory)
+-- 2015-01-01 (root directory of snapshot of subvolume "root")
+-- 2015-06-01 (root directory of snapshot of subvolume "root")
\-- home (directory)
\-- 2015-01-01 (root directory of snapshot of subvolume "home")
\-- 2015-12-01 (root directory of snapshot of subvolume "home")
This link might help as well: https://www.ibm.com/docs/en/spectrum...rfs-subvolumes

vieno 03-14-2023 08:09 PM

[QUOTE=JJJCR;6417392]From this link below, i believe you will need to mount the snapshot and recover from there.

The references are useful and informative. In the end I read some guides and documentation by Arch and OpenSUSE for setting up snapshots using "Snapper" (instead of Timeshift). I then came to learn, as you've rightly pointed out - the necessity of not only setting up btrfs subvolumes / and /home but also snapshot subvolumes /.snapshots and /home/.snapshots

For anyone else who might be just getting started with btrfs and wanting to setup snapshots on Fedora 37, I recommend this website https://sysguides.com/ (there are also videos). The guide was easy to follow with adequate explanations for a newbie.

Thanks again for the info, it's starting to make more sense now.


All times are GMT -5. The time now is 04:41 PM.