Re: How do I restore BTRFS snapshots ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 1, 2020 at 2:06 AM Sreyan Chakravarty <sreyan32@xxxxxxxxx> wrote:
>
>
>
> On Mon, Nov 30, 2020 at 10:12 PM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
>>
>>
>> I don't understand why you're going to another forum to ask the same
>> question, and posting different information. It's just making it more
>> difficult to provide answers. Here is what you posted there:
>>
>
> Since I did not know about BTRFS.
>
>>
>> $ btrfs subvolume list /
>> ID 256 gen 3794 top level 5 path fedora
>> ID 264 gen 2296 top level 256 path root/snapshots/test
>>
>> That is not a default subvolume layout for Fedora 33. I have no idea
>> how you arrived at this layout but it's not the default. If you do a
>> default (automatic) installation of Fedora 33, you will have two
>> subvolumes: home and root, at the top level.
>
>
> Ok, I have managed to get BTRFS snapshots working.
>
> I must have messed up the installation somehow. Now I have a subvolume under the toplevel volume which I can now rename.
>
> But the problem is that I have to reboot to a live CD just to take a snapshot.

No you don't.

> Any way to do it within the OS ?

I gave an explicit, line by line example, in this thread, two days ago.

The unintuitive part of that particular example, is mounting the
top-level of the file system. If you have a default Fedora 33
installation, this can be done by mounting the main volume (the
device+partition listed in 'df' for both / and /home) to something
like /mnt or wherever else you prefer. And now you will see what look
like directories named "root" and "home" - but those are subvolumes.
And you can snapshot them. Keeping all subvolumes and snapshots in
this normally hidden top-level is referred to as the "flat" layout.

https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Layout

In the "nested" layout, you don't have to mount the top-level, you can
just directly snapshot the mountpoint. e.g.

btrfs subvolume snapshot /home /home/home.snapshot1

That will snapshot the "home" subvolume that is mounted at /home, and
place it in /home with the name home.snapshot1. The reason it's
referred to as "nested" layout is because these subvolume snapshots
appear to be located within the subvolume you just just snapshot.

As a consequence of this, if you 'du /home' it will add up all of the
stuff in /home two times. Once for the "home" subvolume and again for
the "home.snapshot1" subvolume snapshot. It doesn't know that one of
them is a snapshot, nor that you'd want to exclude one of them from
the usage calculation. Hence 'btrfs filesystem du -s /path/' which
provides more information.

Another example:

btrfs subvolume snapshot / /root.snapshot

This will snapshot the "root" subvolume that is mounted at /, and
place it /, with the name root.snapshot1. Btrfs snapshots are not on
rails. It will let you create a snapshot anywhere. Another set of
examples:

btrfs subvolume snapshot /home /root/home.snapshot
btrfs subvolume snapshot / /home/

I'm not sure why anyone would organize snapshots that way, but btrfs
doesn't care, it'll let you do it.


-- 
Chris Murphy
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux