Creating a snapshot is not the backup itself. It is basically freezing the current state of your files from this point on and then remembering what has chanced compared to the snapshot. So yes, it is normal that this takes no time since nothing is copied on your hard drive. If you want to backup the snapshot you need to make an actual backup of it. This is possible with btrfs. But since I haven’t done it yet, I can’t tell you the exact command.
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
https://github.com/digint/btrbk
Is the best tool for automating btrfs snapshots and backups.
How does it compare to snapper? It seems like they do basically the same thing
so it is a completely different process than with rsync... I always thought of the two ways are pretty similar
Copy on write is the difference. As I understand it, a btrfs snapshot takes no space when it's created (beyond the file system record). The filesystem is always writing changes to file chunks as a new copy of the chunk, which is then recorded as a replacement of the old chunk (which is still present on-disk). So a snapshot tracks all of these later changes, and the file system keeps the old file chunks preserved as long as you keep the snapshot. That's why you can mount a btrfs snapshot. It just shows you the volume through the lens of all of these saved changes.
When you delete a snapshot you are then marking these preserved chunks as free space. So that is also quick.
Whoever invented this is a genius, a genius...
thanks for the help!
Yep, you're doing it right... or at least that's how I do it as well, lol 😂.
A snapshot is exactly that, a snapshot. It doesn't take forever to create, like with rsync, it litelarly takes a second, even on very old rigs (775 or even older). It's basically a snapshot of what the current drive holds. If a file changes (gets added, removed, whatever), the snapshot grows cuz it needs to hold the older versions of the files (the ones saved at the time of the snapshot).
This might not be exactly how snapshots work in BTRFS, but this is what I gathered from using it with snapshots enabled. The older the snapshot, the larger the size of the snapshot (takes way more room cuz more changes have occured).
Also, it's wise to set up daily, weekly and monthly snapshots. I have it set up to hold 5 or 6 (can't really remember now) daily snapshots, 4 weekly and 2 montly. So basically, I can go back in time for a max of 2 months. I was thinking or raising the montly snapshots to 3 or 4, but I'm still not sure. Still, I wouldn't go lower than 2.
Also, it’s wise to set up daily, weekly and monthly snapshots
wouldn't this take a lot of disk space?
Nah, I got it set up on a P4 with a 20GB drive, takes about 2 or 3GB. As time progresses, older snapshots get deleted automatically by Timeshift 😉. So, say you got 4 daily set up, 4 weekly and 2 montly. Only the last 4 daily, 4 weekly and 2 monthly stay, the rest are deleted as new snapshots are created. That's the while point of having this setup, so you can go back in time, but you decide how long.
woah! this is amazing! thanks for the help!!!
NP, glad I could help 😉 👍.
Depends on your needs and if you want to include changes made to documents in home for example while you work during the day. For me the OS just does snapshotting when packages are updated so I can rollback if something breaks. The rest I do normal backups. because snapshotting is not backup if its on the same machine. Btrfs Send will let you push a snapshot elsrwhere though.
Depends on how much you change per time unit.
I take full system backups every three hours, but the backups are thinned so that there are previous 24 hourly ones, previous n daily ones, previous m monthly ones, etc. Similar approach can be used with snapshots.
I don't currently use snapshots—I don't run btrfs anymore—but when I did, I did a snapshot every hour and kept them for 24 hours. But then I backed up the latest snapshot, which gives consistent backups, versus regular backups where files can change while you're doing them. I'm nowadays using bcachefs, but I don't quite trust its snapshots yet so I haven't started using them ;).
I'm nowadays using bcachefs...
Haven't heard of this FS, so I checked the specs... was actually hoping to see a working RAID5/6 feature, but as it stands now it only supports RAID1/0/10. Too bad, would've considered it as a viable option to mdadm + BTRFS.
It said the code base was build on something stable, but it didn't say what, do you happen to know what FS this project is a fork of?
Too bad, would’ve considered it as a viable option to mdadm + BTRFS.
Currently I'm using bcachefs with LVM (which can do raid, but I currently only have one NVME SSD), though it indeed does have RAID1/0/10 support. But overall I expect it not to not make the same silly default choices as btrfs, such as not being able to start the system if a RAID1 component of your root filesystem is missing. And, supposedly, when the RAID5/6 becomes stable, it won't have the write hole problem.
It said the code base was build on something stable, but it didn’t say what, do you happen to know what FS this project is a fork of?
It's based on bcache :) by the same author, but of course bcache is not really a file system but rather some kind of object storage layer for the purpose of caching slower block devices and absorbing write load.
Bcachefs might be coming soon to the mainline kernel, so that's going to make it a lot easier to try out. Personally however I have lost one bcachefs (that FS was readable, though, and I have good backups), but I have also lost a btrfs before and seen reiserfs bugs, so I don't too heavily count it against it; overall I enjoy its stability when using basic functionality. I haven't dared trying snapshots with it yet..
thats normal. Btrfs only saves a copy of the files once you change them afaik
"I currently decided to store the snapshot on the same hard drive of my installation"
That wont do you any good if you get a harddrive crash or need to reinstall. The way i would do it is to make snapshots on a USB and also keep another liveISO USB. That way i can reinstall, then just use timeshift to restore.
I'll definitely have to procurate me a dedicated usb flash!