Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Here's a hypothetical setup on a recent linux kernel:

/dev/sda1 is formatted as btrfs

I then run the following to make two subvolumes on the the root of /dev/sda1:

$ mount /dev/sda1 /mnt
$ btrfs subvolume create /mnt/a
$ btrfs subvolume create /mnt/b
$ umount /mnt

Now I wish to mount both those subvolumes at the same time on two different mount points:

$ mount -o subvol=a /dev/sda1 /a
$ mount -o subvol=b /dev/sda1 /b

Here's the problem. I tried this with a file as block device (using loop) and it worked fine (at least for touching two files in each). However, after installing a complete system, putting the root in one subvolume, and the home directory in another, mounting both at boot, I got an error telling me that the underlying device was "write protected" and at first attempt to read the home directory content led to a kernel crash.

I'd like to know if what I want to do (mounting a single block device more than once with different mount options) is actually allowed by btrfs or in general by the os.

share|improve this question
    
Please can you post the contents of your /etc/fstab file? –  fahadsadah Oct 24 '10 at 8:02

1 Answer 1

You could define the subvolume a that should act as root as default.
in this case it will automatically be mounted instead of the btrfs root.

Assuming your btrfs tree looks like this

/
|
|----a (subvolume containing / directory)
|
|----b (subvolume containing home directory)

in order to set a as default:

mount /dev/sda1 /mnt
btrfs subvolume create /mnt/a
btrfs subvolume set-default /mnt/a

now you can mount your btrfs filesystem and then the subvolume b

mount -o defaults /dev/sda1 /a
mount -o defaults,subvol=b /dev/sda1 /b
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.