LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-07-2021, 10:41 AM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
How to rollback btrfs snapshot?


Hello

I have taken a snapshot of / filesystem and I want to roll back the changes I made. How do I do that in btrfs? Can't figure it out.

Following are my subvolumes

Code:
# btrfs subvolume list /
ID 257 gen 1571 top level 5 path home
ID 258 gen 1659 top level 5 path root
ID 259 gen 15 top level 5 path snap
ID 263 gen 1538 top level 258 path var/lib/machines
I took a snapshot of / filesystem.
Code:
# btrfs subvolume snapshot / /snap/root_snap
Create a snapshot of '/' in '/snap/root_snap'

# btrfs subvolume list -p /
ID 257 gen 1571 parent 5 top level 5 path home
ID 258 gen 1660 parent 5 top level 5 path root
ID 259 gen 1660 parent 5 top level 5 path snap
ID 263 gen 1538 parent 258 top level 258 path var/lib/machines
ID 266 gen 1661 parent 259 top level 259 path snap/root_snap

# btrfs subvolume show /
root
	Name: 			root
	UUID: 			1a05e590-a495-3a46-adb8-a92f07b2f113
	Parent UUID: 		-
	Received UUID: 		-
	Creation time: 		2021-05-07 13:03:25 +0530
	Subvolume ID: 		258
	Generation: 		1662
	Gen at creation: 	11
	Parent ID: 		5
	Top level ID: 		5
	Flags: 			-
	Snapshot(s):
				snap/root_snap
# btrfs subvolume show /snap/root_snap/
snap/root_snap
	Name: 			root_snap
	UUID: 			f5049b81-19d9-824d-8b3b-398ea9ce75bf
	Parent UUID: 		1a05e590-a495-3a46-adb8-a92f07b2f113
	Received UUID: 		-
	Creation time: 		2021-05-07 21:02:11 +0530
	Subvolume ID: 		266
	Generation: 		1661
	Gen at creation: 	1660
	Parent ID: 		259
	Top level ID: 		259
	Flags: 			-
	Snapshot(s):
I tried this command to revert. But the changes are not reflected when I reboot the system.

Code:
# btrfs subvolume set-default 266 /
My fstab is like this:
Code:
# grep -v '^#' /etc/fstab

UUID=dff89ea6-eee3-49f8-8bde-fc5ac871e912 /                       btrfs   subvol=root,noatime,compress=zstd:1,x-systemd.device-timeout=0 0 0
UUID=ae30a4b0-5700-45ad-9aa3-2bbf0d950b5c /boot                   ext4    defaults        1 2
UUID=D445-C7D6			          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=dff89ea6-eee3-49f8-8bde-fc5ac871e912 /home                   btrfs   subvol=home,noatime,compress=zstd:1,x-systemd.device-timeout=0 0 0
UUID=dff89ea6-eee3-49f8-8bde-fc5ac871e912 /snap                   btrfs   subvol=snap,noatime,compress=zstd:1,x-systemd.device-timeout=0 0 0
How do I revert back to snapshot?

Thanks
 
Old 05-07-2021, 01:45 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
https://linuxhint.com/use-btrfs-snapshots/
usually you just copy back the files/dirs you want to restore.
 
1 members found this post helpful.
Old 05-07-2021, 05:05 PM   #3
Bonzoo
Member
 
Registered: Sep 2018
Location: Costa Rica
Distribution: Antix21a2,Parrot rolling,MXfce19.4,Sparky Openbox
Posts: 233

Rep: Reputation: 48
Use timeshift. Much more straight forward
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BTRFS rollback, still broken, how? TenEighty Linux - Server 2 09-08-2015 08:06 AM
LXer: Rollback To A Working State With btrfs + apt-btrfs-snapshot On Ubuntu 12.10 LXer Syndicated Linux News 0 11-25-2012 10:42 AM
Provision Entitlement/snapshot rollback gparker Red Hat 4 08-19-2010 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration