You are not logged in.
Pages: 1
I want to set a backup mechanism with btrfs subvolumes.
I am going step by step as not everything is clear to me about btrfs files system.
Below is part of my current set up:
$ cat /etc/fstab
/dev/nvme0n1p2 LABEL=Magnolia
UUID=6ca0f63e-7327-444e-af89-ac82d08fda59 /home btrfs rw,noatime,ssd,discard,space_cache=v2,subvol=/@home 0 0
/dev/sda1 LABEL=backup
UUID=dccf798a-53a3-4fe5-aa77-95dc0fd28458 /backup btrfs rw,noatime,ssd,discard,space_cache=v2 0 0
------------------
# btrfs subvolume list /
ID 256 gen 61962 top level 5 path @
ID 257 gen 61962 top level 5 path @home
------------------------------------
$ lsblk
├─sda1 btrfs 400G 0% /backup backup dccf798a-53a3-4fe5-aa77-95dc0fd28458Now I try this command:
# cd /
# btrfs subvolume snapshot @home /backup/snap_test
[sudo] password for gabx:
ERROR: Could not statfs: No such file or directoryWhat ma I doing wrong when running this command?
Last edited by gabx (2024-09-05 10:56:53)
Offline
from the manpage
btrfs subvolume is used to create/delete/list/show btrfs subvolumes and snapshots.
A BTRFS subvolume is a part of filesystem with its own independent file/directory hierarchy and inode number namespace.
Your /backup is ***not*** part of the filesystem, it's "another" filesystem.
Offline
I understand this. So what am I supposed to do?
Offline
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
So, I need to send the @home subvolume to the destination folder, /backup and not to run the snapshot commad? something like:
# btrfs send @home | btrfs receive /backupOr shall I create a @backup subvolume and make it belong to the same group than the @home subvolume and in this case use the snapshot command?
The idea is to back up on another drive, in my case an external one (/backup is a partition of an external SSD)
Last edited by gabx (2024-09-03 21:22:20)
Offline
I'm not well versed on the specifics, but the wiki page says that the snapshot being sent _must_ be read-only, so it's likely that you'll need to create a read-only snapshot first, then 'send' that, rather than sending the '@home' subvol directly.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I also don't use the send/receive, nor read much about it from other users.
Maybe it's not widely used ?
If you search for a well tested, robust backup/snapshot solution, which has for sure many users, I recommend
https://wiki.archlinux.org/title/Rsync#Snapshot_backup
which is based on file-system hardlinks.
Offline
I want to set a backup mechanism with btrfs subvolumes
A snapshot is not a backup. If the filesystem is corrupted then the snapshots will also be lost.
What ma I doing wrong when running this command?
The @home subvolume is mounted under /home/ so you should use the mountpoint instead of the subvolume name.
Jin, Jîyan, Azadî
Offline
The @home subvolume is mounted under /home/ so you should use the mountpoint instead of the subvolume name.
running the following command leaves me with an error:
# btrfs subvolume snapshot /home /backup/snap_test
ERROR: cannot snapshot '/home': Invalid cross-device linkIt looks like there is an issue as /home and /backup/snap_test are not on the same device. I guess I must mix the snapshot with the send command.
Offline
[deleted]
Last edited by willemw (2024-09-05 09:20:18)
Offline
the snapshot creation works if both source and destination folders are on the same BTRFS device.
# btrfs subvolume snapshot /home /home/home_snapshot_$(date +%Y%m%d)
Create snapshot of '/home' in '/home/home_snapshot_20240905'
$ ls -al /home
....
drwxr-xr-x 1 root root 24 Jul 10 16:44 home_snapshot_20240905/Thereafter I can send the snapshot to an external drive.
Offline
Pages: 1