I performed a standard Debian install using wheezy/testing netinst iso for amd64. After the install completed I booted into a live environment so that I could snapshot the root as a btrfs subvolume named 'root'. To do so I renamed the /root directory to /rootuser temporarily however I am not able to move /rootuser back to /root in the new subvolume. I've seen other posts where people rename and move around the /root directory without any appearent issue. Is this a bug with btrfs? Here are the steps to replicate:

Install Debian on btrfs (/dev/sda3, /dev/sda1=/boot (ext4), /dev/sda2=swap), reboot into live environment (Linux Mint Debian Ediiton 2012-04 in my case) then from a terminal:

$ sudo su - 
# btrfs filesystem label /dev/sda3 root
# mkdir /media/root
# mount /dev/sda3 /media/root
# cd /media/root
# mv /root /rootuser
# btrfs subvolume snapshot . root
# btrfs subvolume list . # get the subvolume id as $SUBVOLID
# btrfs subvolume set-default $SUBVOLID root
# rm -rf bin boot etc ... # everything except the root subvolume.
# mv root/rootuser root/root

The result is a 'not permitted' error.

# mkdir root/root

results ins an 'already exists' message.

I've also tried the equivelent from inside a chroot environment via:

# mount /dev/sda1 boot
# mount --rbind /dev dev
# mount --rbind /proc proc
# mount --rbind /sys sys
# chroot /media/root/root /bin/bash

but I got the same results.

Am I doing something wrong? Any pointers would be helpful. I know I shouldn't have messed with he /root folder in the first place, but it's too late now.

  • Just moving /root does not cause any serious problems because it's just the root user's home directory. The root account will just loose things such as shell history and profile. An account without a home directory would still function.
    – aseq
    Apr 17, 2012 at 21:20
  • I see you havent had much success with this here, so I'm going to move it to our specialist Unix/Linux site; they can probably help with this as well. Apr 18, 2012 at 0:50
  • @aseq: I'm aware that the root account still functions fine, I'm just trying to determine why it won't let me create the /root folder. Thanks for your time and input though.
    – Beau
    Apr 18, 2012 at 1:24
  • Yes I understand. I was just trying to re-assure you that just moving /root is not the cause of your problem (considering your last sentence).
    – aseq
    Apr 18, 2012 at 1:30

1 Answer 1

# cd /media/root
# mv /root /rootuser

Whoops?! Perhaps you meant to do this, instead:

# mv root rootuser

Assuming no typo in your question, that's probably the reason why you later find /media/root/root already exists. You never moved it out of the way!

  • No, no typo is involved, it is the root user's home directory /root, and no I verified that it had moved, verification is automatic in the fact that the command 'btrfs subvolume snapshot . root' worked and created a snapshot of the unnamed (subvolid=0) btrfs volume. As a proof I did the following on my laptop which is also on btrfs: # cd / # mkdir blah # btrfs subvolume snapshot / blah ERROR: incorrect snapshot name ('/') # btrfs subvolume snapshot / blah2 Create a snapshot of '/' in './blah2'
    – Beau
    Apr 18, 2012 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .