Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Resolved] Btrfs rolling back root subvolume?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Resolved] Btrfs rolling back root subvolume?

#1 Post by bester69 »

Hi,

Im new with btrf's snapshots, and im a bit lost, can you give me any help?

Ive this in fstab:
UUID=5a261bc5-1828-4588-b9a7-beb5f78a20e5 / btrfs defaults 0 1
UUID=5a261bc5-1828-4588-b9a7-beb5f78a20e5 /home/myuser/ btrfs subvolid=296 0 0

I did a full system snaphsot, and i want to try to restore it:
bester@hall:~$ snaplist
ID 296 gen 4835 top level 5 path snap/myhome
ID 300 gen 2641 top level 296 path snap/myhome/.snapshots
ID 304 gen 2623 top level 300 path snap/myhome/.snapshots/1/snapshot
ID 308 gen 2974 top level 5 path snap/fullsys-2016-11-17

I want to restore ID 308 in /, I'd do something like--> mount -o subvolid=308 /dev/sda2 / ,

1- but how do i do this propertly to be mounted (entry in fstab....)??,

2- where do i keep current point system state (subvolid=0)??

1,2- I meant, How do i replace subvolid=0 with subvolid=308?
Last edited by bester69 on 2016-11-19 01:25, edited 1 time in total.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Btrfs rolling back root subvolume?

#2 Post by bester69 »

Do i have to use Livecd and rsync, to rollback snapshot over /?
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Btrfs rolling back root subvolume?

#3 Post by pylkko »

you don't say if you use a bootloader. you need to first boot into the old snapshot. so, if you use grub change the bootline to point to the old snapshot you want. https://wiki.archlinux.org/index.php/Bt ... _with_GRUB

I don't know if you saw that I posted this: http://forums.debian.net/viewtopic.php?f=16&t=130512

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Btrfs rolling back root subvolume?

#4 Post by bester69 »

pylkko wrote:you don't say if you use a bootloader. you need to first boot into the old snapshot. so, if you use grub change the bootline to point to the old snapshot you want. https://wiki.archlinux.org/index.php/Bt ... _with_GRUB

I don't know if you saw that I posted this: http://forums.debian.net/vifuewtopic.php?f=16&t=130512
Its really wonderfull btrfs's snapshots :o , Ive already boot in the sullsystem snapshot by using

Code: Select all

btrfs subvolume set-default 308 /
Im going to watch your tutorial right now, to learn something more,

Thanks a lot, pylkko :wink:
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Btrfs rolling back root subvolume?

#5 Post by bester69 »

OK, So, I can use a system snapshot by using:

1- set-default
http://dustymabe.com/2013/01/06/os-upgr ... ing-btrfs/

Code: Select all

btrfs subvolume set-default 308 /
2- Pointing grub to snaphot
2.1 - Temporary boot
https://bbs.archlinux.org/viewtopic.php?id=173287

Code: Select all

initrd=/boot/initramfs-linux.img root=LABEL=btrfs rw [b]rootflags=subvol=rootfs[/b]
2.2 - Permanent boot
http://logan.tw/posts/2015/05/17/grub-i ... le-system/

Code: Select all

chroot /snapshoot
grub-install /update-grub
So, If you can take a snapshot from a snapshot and you also can drop any snapshot, is there any problem with taking as current system a snapshot instead base installation (subvolid=0)?? :?:
:roll:
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Btrfs rolling back root subvolume?

#6 Post by pylkko »

All of this depends on how the layout of the install is put in place. It would be a different situation if the entire system was put in a btrfs partition or if there are subvolumes under the main tree, and if you are using a bootloader or not and whether or not you have partition table or just one big btrfs block (distinct /boot partition?).

If you change the default subvolume to a snapshot, you will be going lower in the tree and the higher branches will "still be there". So one problem is obviously disk space. Every time you make a snapshot you are storing metadata. So if you delete stuff from your original subvolume, it will not free the space until you get rid of the link to the metadata (otherwise you would not be able to roll back to different versions of the disk, that is if the info was not somewhere). For this reason it is possible to reach the paradoxical situation where you delete more and more stuff but use more and more space. To avoid situations where the "disk complains that there is no space even though there is space" I think it is better to keep the structure as simple as possible, so that your highest level is what you actually use and you don't store too many snapshot in general.
https://btrfs.wiki.kernel.org/index.php/SysadminGuide wrote:Changing the default subvolume with btrfs subvolume default will make the top level of the filesystem inaccessible
This means that when you set the default subvolume to a lower part in the tree, as long as you are mounted there, you will not be able to access the higher locations. But why leave it hanging around when most of the time when you want to rollback it is because the current system is garbage.

If you look at the Ubuntu wiki on btrfs, they say to not use set-default as this will brake the install (https://help.ubuntu.com/community/btrfs ... a_snapshot). This is because the mount options rely on the fact that the subvolumes "can be located below the default mounting subvolume". Of course, one could use other mount options in fstab and kernel line than the ones that Ubuntu use.

But relying on the idea that system trashings happen rarely, for me at least, the most rational stategy seems to be to make automatic snapshots every now and then, then automatically have them be deleted once they get older than a few weeks. And if main system ever decrapitates, then mount previous snapshot and move it on top of the main one.

One more thing. When you want to do something potentially dangerous, maybe dist-upgrade or something, instead of making a snapshot, upgrading and then trying to go back in case of problem, you could also make snap, boot into it and do crazy stuff there (install ubuntu RC ;)), then reboot normally and delete crazy snap... or keep it around keeping your main system minimal and free of bizarre stuff.

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Btrfs rolling back root subvolume?

#7 Post by bester69 »

pylkko wrote:...
One more thing. When you want to do something potentially dangerous, maybe dist-upgrade or something, instead of making a snapshot, upgrading and then trying to go back in case of problem, you could also make snap, boot into it and do crazy stuff there (install ubuntu RC ;)), then reboot normally and delete crazy snap... or keep it around keeping your main system minimal and free of bizarre stuff.
ok pylkko, i really dont want to go deep into it, I just need One Snapshots to rollback, but as my root partition is not a subvolume i dont know exactlly how to procee to restore snapshot to the main partition, I do know how do it if both are subvolume or snapshots..

I saw this article, And they use rsync but i dont feel myself secure by this way, I'd like to be able to clone (rollback) the last good snaphot in the main voume in an easy and secure way.. What do i do? :?:
http://dustymabe.com/2013/01/06/os-upgr ... ing-btrfs/
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Btrfs rolling back root subvolume?

#8 Post by pylkko »

The openSUSE wiki tells how to do that. I put everything into subvolumes, so.I.don't know, but I remember reading in suse guide how to do it if you have root in tree root.

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Btrfs rolling back root subvolume?

#9 Post by bester69 »

pylkko wrote:The openSUSE wiki tells how to do that. I put everything into subvolumes, so.I.don't know, but I remember reading in suse guide how to do it if you have root in tree root.
you're right, the right thing is to put outside everithing in subvolumes,
/
/root (subvolume for installation)
/home (subvolume for user)
/snap (subvolume for snapshots)

we'll use chroot /root to install grub/update-grub
and then in fstab we'll map
/ default
/home/user--> subvolid (home)
/snap --> subvolid (snap)
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply