linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cant mount multi-subvolume via fstab
@ 2012-05-23 15:00 Rogerio Bastos
  2012-05-23 15:33 ` Hugo Mills
  2012-05-23 17:31 ` Goffredo Baroncelli
  0 siblings, 2 replies; 6+ messages in thread
From: Rogerio Bastos @ 2012-05-23 15:00 UTC (permalink / raw)
  To: linux-btrfs

Hi,

I'm trying mount many subvolume during boot via fstab:

UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0
UUID=xxx /home btrfs subvol=home,nodev,nosuid 0 0
UUID=xxx /var btrfs subvol=var,nodev 0 0
UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0

But only the first one is mounted. When try to mount the others
subvolumes, I get this error:

mount: /dev/sda3 already mounted or /home busy
mount: according to mtab, /dev/sda3 is mounted on /usr
mount: /dev/sda3 already mounted or /var busy
mount: according to mtab, /dev/sda3 is mounted on /usr
mount: mount point /var/tmp does not exist

I'm using linux kernel 3.3.6 and mount 2.20 in Debian 7.

-- 

Rogerio de Carvalho Bastos

http://wiki.dcc.ufba.br/Main/RogerioBastos

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cant mount multi-subvolume via fstab
  2012-05-23 15:00 Cant mount multi-subvolume via fstab Rogerio Bastos
@ 2012-05-23 15:33 ` Hugo Mills
  2012-05-23 16:24   ` ROGERIO DE CARVALHO BASTOS
  2012-05-23 17:31 ` Goffredo Baroncelli
  1 sibling, 1 reply; 6+ messages in thread
From: Hugo Mills @ 2012-05-23 15:33 UTC (permalink / raw)
  To: Rogerio Bastos; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

On Wed, May 23, 2012 at 12:00:02PM -0300, Rogerio Bastos wrote:
> Hi,
> 
> I'm trying mount many subvolume during boot via fstab:
> 
> UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0
> UUID=xxx /home btrfs subvol=home,nodev,nosuid 0 0
> UUID=xxx /var btrfs subvol=var,nodev 0 0
> UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0
> 
> But only the first one is mounted. When try to mount the others
> subvolumes, I get this error:
> 
> mount: /dev/sda3 already mounted or /home busy
> mount: according to mtab, /dev/sda3 is mounted on /usr
> mount: /dev/sda3 already mounted or /var busy
> mount: according to mtab, /dev/sda3 is mounted on /usr
> mount: mount point /var/tmp does not exist
> 
> I'm using linux kernel 3.3.6 and mount 2.20 in Debian 7.

   How are your subvolumes arranged?

   If you have:

top-level            # default subvolume mounted as /
        `--- home
        `--- usr
        `--- var
               `--- tmp

and you are mounting / first, then you don't need to mount the
subvolumes, as they're already visible within /  I'm not quite sure
what the consequences of mounting a subvolume directly onto itself as
a mountpoint are -- but it may have this effect.

   If you have:

top-level
        `--- root    # default subvolume mounted as /
        `--- home
        `--- usr

then you should be able to (and have to) mount them separately.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
            --- UNIX:  Japanese brand of food containers. ---            

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cant mount multi-subvolume via fstab
  2012-05-23 15:33 ` Hugo Mills
@ 2012-05-23 16:24   ` ROGERIO DE CARVALHO BASTOS
  0 siblings, 0 replies; 6+ messages in thread
From: ROGERIO DE CARVALHO BASTOS @ 2012-05-23 16:24 UTC (permalink / raw)
  To: Hugo Mills; +Cc: linux-btrfs

Quoting Hugo Mills <hugo@carfax.org.uk>:

> On Wed, May 23, 2012 at 12:00:02PM -0300, Rogerio Bastos wrote:
>> Hi,
>>
>> I'm trying mount many subvolume during boot via fstab:
>>
>> UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0
>> UUID=xxx /home btrfs subvol=home,nodev,nosuid 0 0
>> UUID=xxx /var btrfs subvol=var,nodev 0 0
>> UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0
>>
>> But only the first one is mounted. When try to mount the others
>> subvolumes, I get this error:
>>
>> mount: /dev/sda3 already mounted or /home busy
>> mount: according to mtab, /dev/sda3 is mounted on /usr
>> mount: /dev/sda3 already mounted or /var busy
>> mount: according to mtab, /dev/sda3 is mounted on /usr
>> mount: mount point /var/tmp does not exist
>>
>> I'm using linux kernel 3.3.6 and mount 2.20 in Debian 7.
>
>    How are your subvolumes arranged?
>
>    If you have:
>
> top-level            # default subvolume mounted as /
>         `--- home
>         `--- usr
>         `--- var
>                `--- tmp
>
> and you are mounting / first, then you don't need to mount the
> subvolumes, as they're already visible within /  I'm not quite sure
> what the consequences of mounting a subvolume directly onto itself as
> a mountpoint are -- but it may have this effect.
>
>    If you have:
>
> top-level
>         `--- root    # default subvolume mounted as /
>         `--- home
>         `--- usr
>
> then you should be able to (and have to) mount them separately.
>
>    Hugo.

I have two partitions:

/dev/sda1 (top-level)  # root filesystem


/dev/sda3 (top-level)
    `--- home
    `--- var
    `--- var-tmp
    `--- usr


The sda3's top-level isn't being mounted.

-- 

Rogerio de Carvalho Bastos

http://wiki.dcc.ufba.br/Main/RogerioBastos


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cant mount multi-subvolume via fstab
  2012-05-23 15:00 Cant mount multi-subvolume via fstab Rogerio Bastos
  2012-05-23 15:33 ` Hugo Mills
@ 2012-05-23 17:31 ` Goffredo Baroncelli
  2012-05-24 23:33   ` Rogerio Bastos
  1 sibling, 1 reply; 6+ messages in thread
From: Goffredo Baroncelli @ 2012-05-23 17:31 UTC (permalink / raw)
  To: Rogerio Bastos; +Cc: linux-btrfs, Hugo Mills

Hi Rogerio,

On 05/23/2012 05:00 PM, Rogerio Bastos wrote:
> Hi,
> 
> I'm trying mount many subvolume during boot via fstab:
> 
> UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0
> UUID=xxx /home btrfs subvol=home,nodev,nosuid 0 0
> UUID=xxx /var btrfs subvol=var,nodev 0 0
> UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0
> 
> But only the first one is mounted. When try to mount the others
> subvolumes, I get this error:

I did some tests. It seems that the problem is that you want to mount
different subvolumes *of the same filesystem* (/dev/sda3) both in RO
(first entry) and RW (the other entries).

Please try to removing the 'RO' for the first entry, and let know us
what happens.

BR
Goffredo

> 
> mount: /dev/sda3 already mounted or /home busy
> mount: according to mtab, /dev/sda3 is mounted on /usr
> mount: /dev/sda3 already mounted or /var busy
> mount: according to mtab, /dev/sda3 is mounted on /usr
> mount: mount point /var/tmp does not exist
> 
> I'm using linux kernel 3.3.6 and mount 2.20 in Debian 7.
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cant mount multi-subvolume via fstab
  2012-05-23 17:31 ` Goffredo Baroncelli
@ 2012-05-24 23:33   ` Rogerio Bastos
  2012-05-26  7:32     ` Duncan
  0 siblings, 1 reply; 6+ messages in thread
From: Rogerio Bastos @ 2012-05-24 23:33 UTC (permalink / raw)
  To: kreijack; +Cc: linux-btrfs, Hugo Mills

On Wed, May 23, 2012 at 07:31:49PM +0200, Goffredo Baroncelli wrote:
> Hi Rogerio,
> 
> On 05/23/2012 05:00 PM, Rogerio Bastos wrote:
> > Hi,
> > 
> > I'm trying mount many subvolume during boot via fstab:
> > 
> > UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0
> > UUID=xxx /home btrfs subvol=home,nodev,nosuid 0 0
> > UUID=xxx /var btrfs subvol=var,nodev 0 0
> > UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0
> > 
> > But only the first one is mounted. When try to mount the others
> > subvolumes, I get this error:
> 
> I did some tests. It seems that the problem is that you want to mount
> different subvolumes *of the same filesystem* (/dev/sda3) both in RO
> (first entry) and RW (the other entries).
> 
> Please try to removing the 'RO' for the first entry, and let know us
> what happens.

You are right, without RO I can mount all subvolume.
Thank you.

> BR
> Goffredo
> 
> > 
> > mount: /dev/sda3 already mounted or /home busy
> > mount: according to mtab, /dev/sda3 is mounted on /usr
> > mount: /dev/sda3 already mounted or /var busy
> > mount: according to mtab, /dev/sda3 is mounted on /usr
> > mount: mount point /var/tmp does not exist
> > 
> > I'm using linux kernel 3.3.6 and mount 2.20 in Debian 7.
> > 
> 

-- 

Rogerio Bastos

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cant mount multi-subvolume via fstab
  2012-05-24 23:33   ` Rogerio Bastos
@ 2012-05-26  7:32     ` Duncan
  0 siblings, 0 replies; 6+ messages in thread
From: Duncan @ 2012-05-26  7:32 UTC (permalink / raw)
  To: linux-btrfs

Rogerio Bastos posted on Thu, 24 May 2012 20:33:16 -0300 as excerpted:

> On Wed, May 23, 2012 at 07:31:49PM +0200, Goffredo Baroncelli wrote:
>> Hi Rogerio,
>> 
>> On 05/23/2012 05:00 PM, Rogerio Bastos wrote:
>> > Hi,
>> > 
>> > I'm trying mount many subvolume during boot via fstab:
>> > 
>> > UUID=xxx /usr btrfs subvol=usr,ro,nodev 0 0 UUID=xxx /home btrfs
>> > subvol=home,nodev,nosuid 0 0 UUID=xxx /var btrfs subvol=var,nodev 0 0
>> > UUID=xxx /var/tmp btrfs subvol=var-tmp,nodev,noexec,nosuid 0 0
>> > 
>> > But only the first one is mounted. When try to mount the others
>> > subvolumes, I get this error:
>> 
>> I did some tests. It seems that the problem is that you want to mount
>> different subvolumes *of the same filesystem* (/dev/sda3) both in RO
>> (first entry) and RW (the other entries).
>> 
>> Please try to removing the 'RO' for the first entry, and let know us
>> what happens.
> 
> You are right, without RO I can mount all subvolume.

If you need the different rw/ro mounts you can use mount --bind.  There's 
a bit of a catch, however, in that an initial mount --bind will always 
have the same ro/rw as the original mount.  You thus have to mount it 
with a mount-bind, then do a remount, to change that.

I do something similar here, not with btrfs (which I tried but had 
problems with, I'll let it mature a few kernels and try again) but with 
some mount-binds into a chroot, before I start the app (named aka bind) I 
run in it.

My fstab has entries like this:

/etc/bind  /m/cbind/etc/bind  none  bind,ro,noexec,nodev,noatime  0 0
/var/bind  /m/cbind/var/bind  none  bind,rw,noexec,nodev,noatime  0 0

But they're on the same source filesystem so the mount -a mounts them 
both the same (rw in my case).  I thus have an initscript "stub" that 
runs between the localmount initscript and the named/bind initscript, 
that does a mount -o,remount.  Since they're setup with the correct 
options in fstab and the initial mount simply ignores them, a simple 
remount gives me the correct options, with ro/rw now kernel enforced.

So while a direct btrfs subvolume mount won't track ro/rw separately, a 
mount-bind, followed by an appropriate remount, should.

But I'd not try that for btrfs specific mount options, autodefrag, 
nodatacow, etc, as I'm not sure how btrfs would react to that.  Just 
generic options such as rw/rw, exec/noexec, etc, which I believe are 
enforced at the block layer, not the filesystem layer itself.

See the mount (8) manpage for more on bind-mounts.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-26  7:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-23 15:00 Cant mount multi-subvolume via fstab Rogerio Bastos
2012-05-23 15:33 ` Hugo Mills
2012-05-23 16:24   ` ROGERIO DE CARVALHO BASTOS
2012-05-23 17:31 ` Goffredo Baroncelli
2012-05-24 23:33   ` Rogerio Bastos
2012-05-26  7:32     ` Duncan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).