LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-27-2013, 03:18 PM   #1
LightSeeker
Member
 
Registered: Nov 2007
Distribution: Manjaro, Win7
Posts: 41

Rep: Reputation: 0
Installing a system with btrfs, managing root snapshots


Hi,

In the near future I would like to install a system (probably Manjaro) but I would like to be able to rollback from an upgrade-gone-bad (which happened to my current system, whee upgrading resulted in some glitches) or any of the other reasons that a person would have to require making snapshots and be able to restore the system to its previous state.

Now the problem for me isn't partitioning or installing, but the way that I should proceed in managin snapshots. I have looked at the btrf wiki, but everything is still not very clear to me, hence the reason I am posting this thread.

As I said, I want to be able to rollback my root system (/). I will probably have a separate home partition. As far as I understand, I should modify my fstab file in order to set the default subvolume. The example given on the btrfs wiki (Sysadmin Guide) is:

LABEL=btr_pool / btrfs defaults 0 0
LABEL=btr_pool /home btrfs defaults,subvol=home 0 0
LABEL=btr_pool /media/btrfs btrfs defaults,noauto,subvolid=0 0 0


If I understand correctly, the last Label creates a subvolume in the root filesystem? Does this mean, that the system will automatically mount the subvolume that is set to 0 at boot? At least that's what I can infer form the document on the Oracle website (http://docs.oracle.com/cd/E37670_01/...se3_btrfs.html), which says: "By default, the operating system mounts the parent btrfs volume, which has an ID of 0, unless you use set-default to change the default subvolume."



Okay, let's say I make a snapshot of the system before upgrading. The btrfs site suggests:

# mount /media/btrfs
# cd /media/btrfs
# btrfs subvolume snapshot root root_snapshot_2011_01_11
# cd ~
# umount /media/btrfs


As I can understand, mounting the /media/btrfs subvolume wihtout any further options automatically mounts the root filesystem? Also the "btrfs subvolume snapshot" command automatically recognizes "root" as / ?

Now suppose an upgrade went bad. How to rollback? The btrfs wiki suggests a solution, but instead of using the root filesystem as the example, it goes with the /home partition:

# mount /media/btrfs
# umount /home
# mount -o defaults,subvol=home_snapshot_A /dev/sda /home
# btrfs subvolume delete /media/btrfs/home # optional; this is so the
# mv /media/btrfs/home_snapshot_A /media/btrfs/home # /etc/fstab need not change.
# umount /media/btrfs


Now since I am still concerned with rolling back the root partition, I guess that I do not need to perform steps 2 (umounting home) and 3 (overriding the default subvolume mount) and just use the mv command to rename the root_snapshot to the name root?

Is that how this process is supposed to be done?

I tried to do it this way (minus the fstab entries) in one of my Vbox installations, but I foud out, that using the mv command just sent my PC into a 20 min high-cpu activity that ate up all most of my designated virtual hard drive space.

p.s.: one more question. Since Btrfs uses copy-on-write, does this mean, that snapshots initially do not consume a significant amount of space, but that this increases with changes made to the system?

Last edited by LightSeeker; 10-27-2013 at 03:32 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: How To Convert An ext3/ext4 Root File System To btrfs On Ubuntu 12.10 LXer Syndicated Linux News 0 11-27-2012 03:01 PM
BTRFS system file zanier Linux - General 2 07-24-2012 09:21 AM
BTRFS file system zanier Linux - Kernel 3 05-27-2012 04:54 PM
btrfs and lilo wont install on the root partition charlie_lab Slackware - Installation 9 09-08-2011 02:17 AM
LXer: Btrfs 0.14, Managing Multiple Devices LXer Syndicated Linux News 0 04-30-2008 08:10 PM


All times are GMT -5. The time now is 03:27 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration