LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-27-2015, 12:21 AM   #1
lemonade
Member
 
Registered: Oct 2015
Posts: 40

Rep: Reputation: Disabled
btrfs root subvolume is inside the home subvolume and need to delete home subvol


Hi, I got a problem with the btrfs subvolumes layout in
my laptop.

Months ago, my system got corrupted and took a snapshot
of 'root' subvolme inside the 'home/' subvolume
(named 'home/.recupera-raiz'). Then I removed the
'root' subvolume.

Now I want to delete 'home' subvolume (to free space)
but I dont know what will happen to 'home/.recupera-raiz'
(the root actually)

Check the table below...

I want to move/snapshot root subvolume anywhere but
not inside 'home'. My problem is that every attempt is creating the snapshot inside the previous one (in the
table, every subvolume/snapshot below 'home/.recupera-raiz'
is just another snapshot of root).

Is it possible somehow take a snapshot of the subvolume
acting as root to result in something like
Code:
ID 260 gen 567680 top level 5 path root
but not in something like this
Code:
ID 1928 gen 567680 top level 1927 path home/.recupera-raiz/oct/root/.snapshots/nuevaraiz
This is my current subvolumes listing:

Code:
ID 257 gen 567283 top level 5 path boot/grub2/i386-pc
ID 258 gen 567283 top level 5 path boot/grub2/x86_64-efi
ID 259 gen 567680 top level 5 path home
ID 260 gen 567680 top level 5 path opt
ID 261 gen 566496 top level 5 path srv
ID 262 gen 567680 top level 5 path tmp
ID 263 gen 567658 top level 5 path usr/local
ID 264 gen 567285 top level 5 path var/crash
ID 265 gen 567285 top level 5 path var/lib/mailman
ID 266 gen 567285 top level 5 path var/lib/named
ID 267 gen 567285 top level 5 path var/lib/pgsql
ID 268 gen 567680 top level 5 path var/log
ID 269 gen 567285 top level 5 path var/opt
ID 270 gen 567680 top level 5 path var/spool
ID 271 gen 567679 top level 5 path var/tmp
ID 277 gen 566854 top level 5 path .snapshots
ID 1841 gen 542325 top level 5 path var/cache/zypp/packages
ID 1862 gen 542325 top level 5 path var/lib/machines
ID 1884 gen 567284 top level 259 path home/.recupera-raiz
ID 1925 gen 566990 top level 1884 path home/.recupera-raiz/oct
ID 1926 gen 567674 top level 1925 path home/.recupera-raiz/oct/root
ID 1927 gen 567664 top level 1926 path home/.recupera-raiz/oct/root/.snapshots
ID 1928 gen 567680 top level 1927 path home/.recupera-raiz/oct/root/.snapshots/nuevaraiz
 
Old 10-27-2015, 05:13 AM   #2
serafean
Member
 
Registered: Mar 2006
Location: Czech Republic
Distribution: Gentoo, Chakra
Posts: 997
Blog Entries: 15

Rep: Reputation: 136Reputation: 136
Hi,

btrfs won't allow you to delete a subvolume containing other subvolumes. So your root backup is kind of safe.
However, every subvolume also behaves like a standard directory - meaning you can apply the mv command to it.
Also the btrfs snapshot command takes a destination parameter :
Code:
btrfs sub snap /home/user /user-bkp
Would create a snapshot of /home/user into / (a subvolume named user-bkp in / with /home/user as parent)

So IMO you have two options : either move the subvolume. Or create a snapshot into a destination. The big difference being : move is recursive, snapshots are not.

Serafean.
 
Old 10-28-2015, 01:11 AM   #3
lemonade
Member
 
Registered: Oct 2015
Posts: 40

Original Poster
Rep: Reputation: Disabled
I didn't know you can move subvolumes. It works instantly when renaming
(move in the same parent directory) but when I did

Code:
mv home/.recupera-raiz /october-root
it started to perform the move as moving to another device (IO at ~100%)
and it also 'moved' the files contained in boot/ (another subvolume).

Considering these subvolumes:
Code:
    home/.recupera-raiz (this is my root: btrfs sub get-default /)
    boot/  (mounted/visible as "home/.recupera-raiz/boot" or/and "/boot/")
    ...
I interrupted the process immediatly because I suppose it was going to fill
the pool storage. The strange thing is that althougth it moved 'boot/' contents
the original files are intact (in home/.recupera-raiz/boot or /boot/) as if
instead of a move it just got copied.

I am getting a little nervous about what to do next. I'm afraid I will
get my laptop unbootable if not already. I'm thinking to do
a

Code:
cp --reflink=always --one-file-system home/.recupera-raiz /october-root

And then change the root to start from with

btrfs sub set-default october-root
but I suppose I'm gonna get the same results, considering I'm actually
rooted on home/.recupera-raiz/, so I suppose it will get named
home/.recupera-raiz/october-root. I dont get it, why is it impossible to
create a completely isolated subvolume?, one that doesnt get contained in
an already existing subvolume.
 
Old 10-29-2015, 07:56 AM   #4
serafean
Member
 
Registered: Mar 2006
Location: Czech Republic
Distribution: Gentoo, Chakra
Posts: 997
Blog Entries: 15

Rep: Reputation: 136Reputation: 136
Quote:
t started to perform the move as moving to another device (IO at ~100%)
and it also 'moved' the files contained in boot/ (another subvolume).
Right... mv works to rename subvolumes/move within one subvolume. Otherwise its a bit more complex.

In this case it's because you were moving between subvolumes. In that case the move has to physically move all the data. (If you read about btrfs internals - specifically the b-tree structure - you'd understand why)

cp --reflink=always sounds like a good solution (used it myself a couple of times too). Never used the --one-file-system option though...

Although snapshotting the snapshot should do the same (slightly more cleanly though)

btrfs sub snap /home/.recupera-raiz /october-root
... And repeat for every /home/.recupera-raiz subvolume (snapshot doesn't handle recursion AFAIK)

Quote:
Originally Posted by lemonade View Post
I dont get it, why is it impossible to
create a completely isolated subvolume?, one that doesnt get contained in
an already existing subvolume.
Because each subvolume is a directory, which means that it needs to have a parent. The only exception is the root subvolume (/). Subvolumes completely disconnected from each other are possible in ZFS. You can simulate it by changing the default subvolume and creating other subvolumes in /.

have good backups... the btrfs send command might help with that.

Good luck!
 
  


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
Is mkinitrd with Btrfs root subvolume still broken? ldepandis Slackware 0 09-12-2015 05:45 PM
Problems with /home mount on a btrfs subvolume - systemd exvor Gentoo 1 06-19-2015 11:19 AM
install with BTRFS: subvolume/partition scheme? horizonbrave Linux - Newbie 5 01-05-2015 08:35 AM
[SOLVED] Btrfs: Moving a large chuck of data from filesystem to subvolume vinbob Linux - Software 1 09-18-2014 04:42 AM
btrfs subvolume quota phil.d.g Linux - Software 0 08-29-2011 12:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:37 PM.

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