* Question on subvolumes and mount options
@ 2011-02-13 16:46 Yuri D'Elia
2011-02-13 17:30 ` Hugo Mills
0 siblings, 1 reply; 5+ messages in thread
From: Yuri D'Elia @ 2011-02-13 16:46 UTC (permalink / raw)
To: linux-btrfs
Hi everyone, I'm experimenting with btrfs but I have some question
regarding subvolumes.
First: In the / filesystem I create a subvolume named /home. As soon as
the subvolume is created, I can already see the entry point in /home
without having to mount it separately. Is that expected?
Mounting the subvolume with mount -o subvol=home /dev/x /home also works
as expected.
So, which is best? Looks like mounting subvolumes is not necessary.
Is it possible to change mount options in a subvolume? Suppose I would
like to use nodatasum except for /home, will the following work?
mount -o nodatasum /dev/x /
btrfs subvolume create /home
mount -o datasum,subvol=home /dev/x
Thanks for any clarification.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on subvolumes and mount options
2011-02-13 16:46 Question on subvolumes and mount options Yuri D'Elia
@ 2011-02-13 17:30 ` Hugo Mills
2011-02-13 17:49 ` Yuri D'Elia
0 siblings, 1 reply; 5+ messages in thread
From: Hugo Mills @ 2011-02-13 17:30 UTC (permalink / raw)
To: Yuri D'Elia; +Cc: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]
On Sun, Feb 13, 2011 at 05:46:46PM +0100, Yuri D'Elia wrote:
> Hi everyone, I'm experimenting with btrfs but I have some question
> regarding subvolumes.
>
> First: In the / filesystem I create a subvolume named /home. As soon as
> the subvolume is created, I can already see the entry point in /home
> without having to mount it separately. Is that expected?
Yes.
> Mounting the subvolume with mount -o subvol=home /dev/x /home also works
> as expected.
>
> So, which is best? Looks like mounting subvolumes is not necessary.
I would recommend putting nothing in the root of the filesystem
*except* subvolumes. i.e. create a "root" subvolume in / that contains
your root filesystem, and make that the default. Then you can mount
your btrfs root subvolume (i.e. the thing that contains all the other
subvolumes) somewhere like /media/btrfs-root, for purposes of managing
subvolumes.
> Is it possible to change mount options in a subvolume? Suppose I would
> like to use nodatasum except for /home, will the following work?
>
> mount -o nodatasum /dev/x /
> btrfs subvolume create /home
> mount -o datasum,subvol=home /dev/x
I'd expect that to work, although I haven't tried it myself.
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
--- I always felt that as a C programmer, I ---
was becoming typecast.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on subvolumes and mount options
2011-02-13 17:30 ` Hugo Mills
@ 2011-02-13 17:49 ` Yuri D'Elia
2011-02-13 19:18 ` Hugo Mills
0 siblings, 1 reply; 5+ messages in thread
From: Yuri D'Elia @ 2011-02-13 17:49 UTC (permalink / raw)
To: linux-btrfs
On Sun, 13 Feb 2011 17:30:59 +0000, Hugo Mills wrote:
>> First: In the / filesystem I create a subvolume named /home. As soon as
>> the subvolume is created, I can already see the entry point in /home
>> without having to mount it separately. Is that expected?
>
> Yes.
What happens if I mount the home subvolume into a different point, like:
mount -o subvol=home /home2
and then change a file in /home (which is accessible through the default
subvolume)?
Will the change be reflected on both mount points? Or the inverse
(change /home2)?
>> So, which is best? Looks like mounting subvolumes is not necessary.
>
> I would recommend putting nothing in the root of the filesystem
> *except* subvolumes. i.e. create a "root" subvolume in / that contains
> your root filesystem, and make that the default. Then you can mount
> your btrfs root subvolume (i.e. the thing that contains all the other
> subvolumes) somewhere like /media/btrfs-root, for purposes of managing
> subvolumes.
So you would recommend creating both /root and /home subvolumes, to be
mounted separately, or create /root and /root/home subvolumes?
>> like to use nodatasum except for /home, will the following work?
>>
>> mount -o nodatasum /dev/x /
>> btrfs subvolume create /home
>> mount -o datasum,subvol=home /dev/x
>
> I'd expect that to work, although I haven't tried it myself.
What if I remount the /home subvol into /home2. What happens when I
touch a file through /home (nodatasum) and what happens when I use
/home2 - since both are available at the same time?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on subvolumes and mount options
2011-02-13 17:49 ` Yuri D'Elia
@ 2011-02-13 19:18 ` Hugo Mills
2011-02-14 11:40 ` Yuri D'Elia
0 siblings, 1 reply; 5+ messages in thread
From: Hugo Mills @ 2011-02-13 19:18 UTC (permalink / raw)
To: Yuri D'Elia; +Cc: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]
On Sun, Feb 13, 2011 at 06:49:58PM +0100, Yuri D'Elia wrote:
> On Sun, 13 Feb 2011 17:30:59 +0000, Hugo Mills wrote:
> >> First: In the / filesystem I create a subvolume named /home. As soon as
> >> the subvolume is created, I can already see the entry point in /home
> >> without having to mount it separately. Is that expected?
> >
> > Yes.
>
> What happens if I mount the home subvolume into a different point, like:
>
> mount -o subvol=home /home2
>
> and then change a file in /home (which is accessible through the default
> subvolume)?
>
> Will the change be reflected on both mount points? Or the inverse
> (change /home2)?
Yes, it's the same piece of storage, just appearing at more than
one point in your overall filesystem. Similar to the way that bind
mounts work.
> >> So, which is best? Looks like mounting subvolumes is not necessary.
> >
> > I would recommend putting nothing in the root of the filesystem
> > *except* subvolumes. i.e. create a "root" subvolume in / that contains
> > your root filesystem, and make that the default. Then you can mount
> > your btrfs root subvolume (i.e. the thing that contains all the other
> > subvolumes) somewhere like /media/btrfs-root, for purposes of managing
> > subvolumes.
>
> So you would recommend creating both /root and /home subvolumes, to be
> mounted separately, or create /root and /root/home subvolumes?
The former.
> >> like to use nodatasum except for /home, will the following work?
> >>
> >> mount -o nodatasum /dev/x /
> >> btrfs subvolume create /home
> >> mount -o datasum,subvol=home /dev/x
> >
> > I'd expect that to work, although I haven't tried it myself.
>
> What if I remount the /home subvol into /home2. What happens when I
> touch a file through /home (nodatasum) and what happens when I use
> /home2 - since both are available at the same time?
They'll stay in sync with respect to the files written to either
one. I'm not sure what the behaviour of nodatasum is with different
mounts of the same subvolume.
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
--- Try everything once, except incest and folk-dancing. ---
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on subvolumes and mount options
2011-02-13 19:18 ` Hugo Mills
@ 2011-02-14 11:40 ` Yuri D'Elia
0 siblings, 0 replies; 5+ messages in thread
From: Yuri D'Elia @ 2011-02-14 11:40 UTC (permalink / raw)
To: linux-btrfs
On Sun, 13 Feb 2011 19:18:20 +0000
Hugo Mills <hugo-lkml@carfax.org.uk> wrote:
> Yes, it's the same piece of storage, just appearing at more than
> one point in your overall filesystem. Similar to the way that bind
> mounts work.
I've noticed that I can also rename subvolumes as well using mv(1).
Can I move/re-arrange subvolumes between them simply using mv?
Does a move between subvolumes involve a copy?
> > So you would recommend creating both /root and /home subvolumes, to be
> > mounted separately, or create /root and /root/home subvolumes?
>
> The former.
Thanks. I can see why this is clearly more flexible in the long term.
> > What if I remount the /home subvol into /home2. What happens when I
> > touch a file through /home (nodatasum) and what happens when I use
> > /home2 - since both are available at the same time?
>
> They'll stay in sync with respect to the files written to either
> one. I'm not sure what the behaviour of nodatasum is with different
> mounts of the same subvolume.
Can we get an exact answer/behavior for that? :)
I mean, can I mount two different subvolumes in the same file system with different flags (such as ssd, nodatasum, compress)?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-14 11:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-13 16:46 Question on subvolumes and mount options Yuri D'Elia
2011-02-13 17:30 ` Hugo Mills
2011-02-13 17:49 ` Yuri D'Elia
2011-02-13 19:18 ` Hugo Mills
2011-02-14 11:40 ` Yuri D'Elia
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).