Re: btrfs snapshots (of root file system)?
On Mon, 2023-10-02 at 21:33 +0200, Anders Andersson wrote: > On Sun, Oct 1, 2023 at 7:20 AM hw wrote: > > > > Hi, > > Hello! I'm not going into much detail but maybe I can guide you to > better be able to find what you want. Hi, like I said, my idea was to take a snapshot of the root file system so that I could roll back after software updates. Unfortunately, that won't work because there won't be snapshots of the MBR and of the UEFI partition, and using clonezilla to copy the volume didn't seem to be a very idea because it's on hardware RAID. I ended up replacing the disks because I wanted to do that anyway and reinstalled. Now I have the problem that during the installation, /home was created as a subvolume, and it can not be deleted. I want /home to be a normal directory because it's mount point for another volume. I resorted to renaming it to /nohome so I could create the /home directory, and I still can't delete it. I might have to reinstall again to get rid of it. Btrfs still says the path to the subvolume is home: # btrfs subvol list / ID 256 gen 61 top level 5 path home ID 257 gen 1286 top level 5 path root ID 258 gen 238 top level 257 path var/lib/machines When I try to delete it, btrfs either says the parameter is invalid or that it's not a subvolume, even when I try to delete it using the ID. I don't have the exact error message now because /home has to mounted to write emails, and I'm not gona try to delete it before unmounting it. So how do you delete a subvolume? Why isn't the path adjusted when renaming it? That must be somehow buggy. > > with btrfs, how do I make a snapshot of the root file system? The > > purpose is to update software and being able to go back to a previous > > state if necessary. > > > > There doesn't seem to be a command to create snapshots but only > > subvolumes? How does a subvolume turn into a snapshot? (The root > > file system is, of course, not on a subvolume.) > > Everything in btrfs is a suvolume, including the root (aka > "top-level"). Well, that is nonsense. Something that's on top isn't on a lower level. > A snapshot is merely a subvolume created *from* another > subvolume, and can optionally be read-only. > > You can take a snapshot of the top level subvolume by doing "btrfs sub > snap / @foo". Documentation for creating both empty subvolumes and > snapshots are in btrfs-subvolume. Isn't that 'btrfs subvolume snapshot ...'? And I would have created the snapshot on the other volume because the other volume is larger. >From what I've been reading that should be no problem. > > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > > older state is merged to the state the snapshot is in. Apparently > > btrfs can only delete snapshots --- and it seems like a bad idea to > > delete the root file system. How would I boot from it when it's been > > deleted? > > I don't think you can merge snapshots the way you describe. I don't > see how it could be atomic? Why would something be atomic? Think of how ZFS does it. IIRC, you either 'destroy' a snapshot, which is misleading because the snapshot isn't destroyed but what the snapshot was made of is being merged with the snapshot such that its origin disappears and what you get is the current version as the result of the merge. Or you 'rollback' to something a snapshot was made of and you get that. Both happens in the same place. That also is so confusing that I never really did anything with snapshots. Btrfs seems to suck in that when you create a snapshot --- which can't be merged --- and, which is very important, it doesn't happen in place: If you want to roll back to a previous version, you somehow need to replace the current version with the old version, and that leaves you with the question of how you put the old version into the newer version after you deleted the newer one. Not being able to do it in place makes me wonder what snapshots are supposed to be for. They're pretty useless when you can't just roll back, and they are no substitue for backups. If you have to make them on the same volume, that's a very severe limitation. So what's the point? Or maybe I got it all wrong. It's confusing. > You can however move subvolumes around freely, create new snapshots > at will, and select the boot subvolume either by the "subvol=" > mount option or by setting the default subvolume (btrfs sub > set-default). So I can create a snapshot on a different volume? I haven't tried. There's no subvolume for /boot but an EFI partition. IIRC that's part of the reason why you can not use btrfs for boot volumes without hardware RAID. When one of the disks fails, you're screwed if the 'right' one is the one that failed. > > Can I make a snapshot on a different volume? The manpage doesn't say > > that the destination of a subvolume must be on the same volume, and in > > any case, I should be able to do that. > > You can create snapshots anywhere *within the same
Re: btrfs snapshots (of root file system)?
On Sun, Oct 1, 2023 at 7:20 AM hw wrote: > > Hi, Hello! I'm not going into much detail but maybe I can guide you to better be able to find what you want. > with btrfs, how do I make a snapshot of the root file system? The > purpose is to update software and being able to go back to a previous > state if necessary. > > There doesn't seem to be a command to create snapshots but only > subvolumes? How does a subvolume turn into a snapshot? (The root > file system is, of course, not on a subvolume.) Everything in btrfs is a suvolume, including the root (aka "top-level"). A snapshot is merely a subvolume created *from* another subvolume, and can optionally be read-only. You can take a snapshot of the top level subvolume by doing "btrfs sub snap / @foo". Documentation for creating both empty subvolumes and snapshots are in btrfs-subvolume. > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > older state is merged to the state the snapshot is in. Apparently > btrfs can only delete snapshots --- and it seems like a bad idea to > delete the root file system. How would I boot from it when it's been > deleted? I don't think you can merge snapshots the way you describe. I don't see how it could be atomic? You can however move subvolumes around freely, create new snapshots at will, and select the boot subvolume either by the "subvol=" mount option or by setting the default subvolume (btrfs sub set-default). > Can I make a snapshot on a different volume? The manpage doesn't say > that the destination of a subvolume must be on the same volume, and in > any case, I should be able to do that. You can create snapshots anywhere *within the same filesystem*. To be fair, the manpage says "A BTRFS subvolume is a part of filesystem" and "A snapshot is also subvolume". It could be more clear.
Fwd: btrfs snapshots (of root file system)?
Try ext4 All the best Keith BAINBRIDGE +61 (0)447 667 468 keithr...@gmail.com UTC + 10 >From my Apad -- Forwarded message - From: Keith Bainbridge Date: Mon, 2 Oct 2023, 20:32 Subject: Re: btrfs snapshots (of root file system)? To: debian-user@lists.debian.org I use timeshift for this. It claims to use btrfs as an option. I've only used rsync on extra, and that has saved my bacon a few times All the best Keith BAINBRIDGE +61 (0)447 667 468 keithr...@gmail.com UTC + 10 >From my Apad On Sun, 1 Oct 2023, 15:10 hw, wrote: > Hi, > > with btrfs, how do I make a snapshot of the root file system? The > purpose is to update software and being able to go back to a previous > state if necessary. > > There doesn't seem to be a command to create snapshots but only > subvolumes? How does a subvolume turn into a snapshot? (The root > file system is, of course, not on a subvolume.) > > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > older state is merged to the state the snapshot is in. Apparently > btrfs can only delete snapshots --- and it seems like a bad idea to > delete the root file system. How would I boot from it when it's been > deleted? > > Can I make a snapshot on a different volume? The manpage doesn't say > that the destination of a subvolume must be on the same volume, and in > any case, I should be able to do that. > >
Re: btrfs snapshots (of root file system)?
I use timeshift for this. It claims to use btrfs as an option. I've only used rsync on extra, and that has saved my bacon a few times All the best Keith BAINBRIDGE +61 (0)447 667 468 keithr...@gmail.com UTC + 10 >From my Apad On Sun, 1 Oct 2023, 15:10 hw, wrote: > Hi, > > with btrfs, how do I make a snapshot of the root file system? The > purpose is to update software and being able to go back to a previous > state if necessary. > > There doesn't seem to be a command to create snapshots but only > subvolumes? How does a subvolume turn into a snapshot? (The root > file system is, of course, not on a subvolume.) > > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > older state is merged to the state the snapshot is in. Apparently > btrfs can only delete snapshots --- and it seems like a bad idea to > delete the root file system. How would I boot from it when it's been > deleted? > > Can I make a snapshot on a different volume? The manpage doesn't say > that the destination of a subvolume must be on the same volume, and in > any case, I should be able to do that. > >
Re: btrfs snapshots (of root file system)?
On Sun, 2023-10-01 at 10:51 +0100, debian-u...@howorth.org.uk wrote: > hw wrote: > > Hi, > > > > with btrfs, how do I make a snapshot of the root file system? The > > purpose is to update software and being able to go back to a previous > > state if necessary. > > > > There doesn't seem to be a command to create snapshots but only > > subvolumes? How does a subvolume turn into a snapshot? (The root > > file system is, of course, not on a subvolume.) > > > > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > > older state is merged to the state the snapshot is in. Apparently > > btrfs can only delete snapshots --- and it seems like a bad idea to > > delete the root file system. How would I boot from it when it's been > > deleted? > > > > Can I make a snapshot on a different volume? The manpage doesn't say > > that the destination of a subvolume must be on the same volume, and in > > any case, I should be able to do that. > > google says: Thanks! It still doesn't make much sense ...
Re: btrfs snapshots (of root file system)?
hw wrote: > Hi, > > with btrfs, how do I make a snapshot of the root file system? The > purpose is to update software and being able to go back to a previous > state if necessary. > > There doesn't seem to be a command to create snapshots but only > subvolumes? How does a subvolume turn into a snapshot? (The root > file system is, of course, not on a subvolume.) > > How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the > older state is merged to the state the snapshot is in. Apparently > btrfs can only delete snapshots --- and it seems like a bad idea to > delete the root file system. How would I boot from it when it's been > deleted? > > Can I make a snapshot on a different volume? The manpage doesn't say > that the destination of a subvolume must be on the same volume, and in > any case, I should be able to do that. google says: https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/SysadminGuide.html#Snapshots https://wiki.archlinux.org/title/btrfs https://wiki.archlinux.org/title/snapper https://fedoramagazine.org/working-with-btrfs-snapshots/ https://linuxhint.com/use-btrfs-snapshots/
btrfs snapshots (of root file system)?
Hi, with btrfs, how do I make a snapshot of the root file system? The purpose is to update software and being able to go back to a previous state if necessary. There doesn't seem to be a command to create snapshots but only subvolumes? How does a subvolume turn into a snapshot? (The root file system is, of course, not on a subvolume.) How do I merge snapshots? IIRC, when you remove a ZFS snapshot, the older state is merged to the state the snapshot is in. Apparently btrfs can only delete snapshots --- and it seems like a bad idea to delete the root file system. How would I boot from it when it's been deleted? Can I make a snapshot on a different volume? The manpage doesn't say that the destination of a subvolume must be on the same volume, and in any case, I should be able to do that.