linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Any method to 'umount' a subvolume?
@ 2013-03-14  4:24 Queen Adam
  2013-03-14  4:32 ` Harald Glatt
  0 siblings, 1 reply; 3+ messages in thread
From: Queen Adam @ 2013-03-14  4:24 UTC (permalink / raw)
  To: linux-btrfs

Hi all,

When using "btrfs sub create test" commands to create a subvolume, it
will create test directory in the current directory.

But the subvol directory can only be delete by "btrfs sub delete"
command, which seems also delete all the data in the subvolume.

Any method about the 'umount'-like method to 'umount' the subvolume
and delete the subvolume directory without deleting all the data?
The method now seems less flexible (can mount -o subvol=test to other
path but the test/ can't be deleted)

Thanks.

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

* Re: Any method to 'umount' a subvolume?
  2013-03-14  4:24 Any method to 'umount' a subvolume? Queen Adam
@ 2013-03-14  4:32 ` Harald Glatt
  2013-03-14  9:52   ` Martin Steigerwald
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Glatt @ 2013-03-14  4:32 UTC (permalink / raw)
  To: Queen Adam; +Cc: linux-btrfs

That's because the test shouldn't be in your root in the first place.
The common way of thinking now is to create a btrfs volume with a
structure for holding subvolumes inside of which your system root is a
member. You then mount the system root via -o subvol= and will only
see it and nothing else. If you want access to the "control" structure
you mount that without -o subvol. If you want to mount another
subvolume (even in place of your root) you mount that with -o subvol
to whereever you want.

Examples:
real btrfs root:
/root/default
/root/snap1
/root/snap2
/home/default
/home/snap1

The system root mounts /root/default on boot via -o
subvol=root/default as well as the /home/default subvolume for /home.

Then if you want to make a snapshot you mount btrfs to something like
/mnt/ctrl and do 'btrfs sub snap / /mnt/ctrl/root/snap3' and umount
/mnt/ctrl again.

Rolling back a snapshot is as easy as mounting /mnt/ctrl and doing 'mv
/mnt/ctrl/root/default /mnt/ctrl/root/default-old && mv
/mnt/ctrl/root/snap3 /mnt/ctrl/root/default' followed by a reboot. No
changes are necessary to your boot system and on the next boot you are
rolled back and can delete the default-old subvol if you desire.

On Thu, Mar 14, 2013 at 5:24 AM, Queen Adam <adam900710@gmail.com> wrote:
> Hi all,
>
> When using "btrfs sub create test" commands to create a subvolume, it
> will create test directory in the current directory.
>
> But the subvol directory can only be delete by "btrfs sub delete"
> command, which seems also delete all the data in the subvolume.
>
> Any method about the 'umount'-like method to 'umount' the subvolume
> and delete the subvolume directory without deleting all the data?
> The method now seems less flexible (can mount -o subvol=test to other
> path but the test/ can't be deleted)
>
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Any method to 'umount' a subvolume?
  2013-03-14  4:32 ` Harald Glatt
@ 2013-03-14  9:52   ` Martin Steigerwald
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Steigerwald @ 2013-03-14  9:52 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Harald Glatt, Queen Adam

Am Donnerstag, 14. März 2013 schrieb Harald Glatt:
> That's because the test shouldn't be in your root in the first place.
> The common way of thinking now is to create a btrfs volume with a
> structure for holding subvolumes inside of which your system root is a
> member. You then mount the system root via -o subvol= and will only
> see it and nothing else. If you want access to the "control" structure
> you mount that without -o subvol. If you want to mount another
> subvolume (even in place of your root) you mount that with -o subvol
> to whereever you want.
> 
> Examples:
> real btrfs root:
> /root/default
> /root/snap1
> /root/snap2
> /home/default
> /home/snap1
> 
> The system root mounts /root/default on boot via -o
> subvol=root/default as well as the /home/default subvolume for /home.
> 
> Then if you want to make a snapshot you mount btrfs to something like
> /mnt/ctrl and do 'btrfs sub snap / /mnt/ctrl/root/snap3' and umount
> /mnt/ctrl again.

I use it that way, but I use

btrfs subvolume set-default NUMBER /mount/path

in order to not have to put the subvolid option into fstab.

Thanks,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

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

end of thread, other threads:[~2013-03-14  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-14  4:24 Any method to 'umount' a subvolume? Queen Adam
2013-03-14  4:32 ` Harald Glatt
2013-03-14  9:52   ` Martin Steigerwald

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).