public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
To: kreijack@gmail.com
Cc: linux-btrfs@vger.kernel.org
Subject: Re: btrfs-progs: New utility to swap subvolumes
Date: Mon, 28 Dec 2009 10:38:42 +0900	[thread overview]
Message-ID: <4B380C22.4010809@jp.fujitsu.com> (raw)
In-Reply-To: <200912272123.37585.kreijack@alice.it>

Thank you for your mail.

I intended to create a swap utility including root subvolume.
That was the goal. Swapping root subvolume is not implemented
yet...

For now, as you say, in some cases this utility does simple
mv commands, but in some cases, it has some advantages.

We can swap subvolumes regardless of mounted-subvolume. (only
when we mount other subvolume than fs tree)
And, because we can identify snapshot (its date or target subvol)
with subvolume ID, it is suitable to swap with ID.

Regards,
taruisi

(2009/12/28 5:23), Goffredo Baroncelli wrote:
> On Thursday 24 December 2009, TARUISI Hiroaki wrote:
>> New utility(btrfsrevert) added to swap subvolumes.
>>
>> With this utility, a subvolume (Source Subvolume) takes place of
>> another subvolume (Target Subvolume), and target subvolume goes
>> under hidden directory(".old_trees") in filesystem root(fs tree,
>> tree id=5), and its name is expanded with random UUID.
> 
> 
> Hi Taruisi,
> 
> which is the supposed goal of this program ? If I understand correctly 
> "btrfsrevert" renames subvolumes. But we can rename a subvolume using the mv 
> command. So "btrfsrevert" may be simulated with a couple of 'mv' command:
> 
> # btrfsrevert -s vola-id -t volb-id /dev/sdX
> 
> is equivalent to
> 
> # mount /dev/sdX/ /mnt  	# only needed if the filesystem is un-mounted
> # mkdir /mnt/.old_trees
> # mv /mnt/volb /mnt/.old_trees/volb.<random-number>
> # mv /mnt/vola /mnt/volb
> # umount /mnt               
> 
> Is right ? And moreover btrfsrevert has the limit that the file-system shall 
> not be mounted...
> 
> On the plus side of btrfsrevert, I can "swap" volumes without having the btrfs 
> module loaded ...
> 
> 
> BR
> G.Baroncelli
> 
>>
>> This utility cannot operate mounted filesystem. This is only for
>> unmounted device.
>> And this utility also cannot operate filesystem root. For now,
>> if we want to swap filesystem root, we can use btrfsctl with
>> Josef Bacik's patch. I wonder which is better, integrating 'root swap'
>> ioctl or not supporting 'root swap' as for this utility...
>>
>> A patch follows this mail.
>>
>>
>> man-page-like description and examples are as follows.
>>
>> NAME
>>        btrfsrevert - swap subvolumes.
>>
>> SYNOPSIS
>>        btrfsrevert -s source_subvolume -t target_subvolume device
>>
>> OPTIONS
>>        -s source subvolume
>>             Specify subvolume number which replace target
>>             subvolume.
>>        -t target subvolume
>>             Specify subvolume number which is replaced by
>>             source subvolume.
>>
>>        device
>>             Specify target device which is not mounted.
>>
>> SAMPLES
>>        Consider two subvolumes 'target'(id=256) and 'source'(id=300)
>>        exist in filesystem root.
>>            / +
>>              +- 'target' (id=256)
>>              +- 'source' (id=300)
>>
>>        In this case, following command swaps subvolume,
>>
>>           # btrfsrevert -s 300 -t 256 /dev/hda1
>>
>>        like this.
>>            / +
>>              +- 'target' (id=300)
>>              |
>>              +- '.old_tree'
>>                  +- 'target_[random uuid]' (id=256)
>>
>>             A subvolume(id:256) is replaced with a subvolume(id:300),
>>             and replaced subvolume(id:256) goes to .old_trees directory.
>>
>> Regards,
>> taruisi
>>
>> --
>> 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
>>
> 
> 


-- 
taruisi


  reply	other threads:[~2009-12-28  1:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-24  2:17 btrfs-progs: New utility to swap subvolumes TARUISI Hiroaki
2009-12-24  2:18 ` [PATCH] " TARUISI Hiroaki
2009-12-27 20:23 ` Goffredo Baroncelli
2009-12-28  1:38   ` TARUISI Hiroaki [this message]
2009-12-28 19:08     ` Goffredo Baroncelli
2010-01-04  0:49     ` TARUISI Hiroaki
2010-01-04 17:20       ` Goffredo Baroncelli
2010-01-06  0:09         ` TARUISI Hiroaki
2010-01-06  7:56           ` Goffredo Baroncelli
     [not found]             ` <4B4450C0.3050607@cs.bgu.ac.il>
2010-01-06 20:21               ` Goffredo Baroncelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B380C22.4010809@jp.fujitsu.com \
    --to=taruishi.hiroak@jp.fujitsu.com \
    --cc=kreijack@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox