Goffredo Baroncelli
2010-Feb-17 20:02 UTC
[PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
Hi all, enclosed in the next two emails you can find two patches which introduce a new program called "btrfs". This program has the ambitious to replace the utilities of the btrfs-prog package, like: - btrfsctl - btrfs-show - btrfs-volume - btrfs The goals are: - improve the usability of the tools - add a man page which documents all the commands - correct the btrfsctl return codes I put a lot of attentions in order to avoid regression respect the old tools. A clone of my git repository is available at http://cassiopea.homelinux.net/git/btrfs-command.git On the basis of the feedback of the previous patches I rearranged some "short command name" (-s, -c ...) in order to avoid collision. I renamed also the command "create" in "subvolume" (and the relative short command name from ''-S'' to ''-c'' :-) ). Chris, do you think that these patches are mergeable ? Comments are welcome. BR Goffredo --- Makefile | 5 btrfs.c | 775 +++++++++++++++++++++++++++++++++++++++++++++++++++++ man/Makefile | 5 man/btrfs.8.in | 122 ++++++++ 4 files changed, 905 insertions(+), 2 deletions(-) -- Example of use: $ btrfs Usage: btrfs snapshot|-s [<dest>/]<name> Create a writeble snapshot of the subvolume <source> with the name <name> in the <dest> directory. btrfs delete|-D <subvolume> Delete the subvolume <subvolume>. btrfs subvolume|-c [<dest>/]<name> Create a subvolume in <dest> (or the current directory if not passed). btrfs defrag|-f <file>|<dir> [<file>|<dir>...] Defragment a file or a directory. btrfs scan|-n [<device> [<device>..] Scan all device for or the passed device for a btrfs filesystem. btrfs fssync|-y <path> Force a fs sync on the filesystem <path> btrfs resize|-z [+/-]<newsize>[gkm]|max <filesystem> Resize the file system. If ''max'' is passed, the filesystem will occupe all available space on the device. btrfs show|-l [<dev>|<label>...] Show the btrfs devices btrfs balance|-b <path> Balance the chunk across the device btrfs add-dev|-A <dev> [<dev>..] <path> Add a device to a filesystem btrfs rm-dev|-R <dev> [<dev>..] <path> Remove a device to a filesystem btrfs help|--help|-h Show the help. Btrfs v0.19-12-g7e4c8e8-dirty BTRFS(8) btrfs BTRFS(8) NAME btrfs - control a btrfs filesystem SYNOPSIS btrfs snapshot|-s <source> [<dest>/]<name> btrfs delete|-D <subvolume> btrfs subvolume|-c [<dest>/]<name> btrfs defrag|-f <file>|<dir> [<file>|<dir>...] btrfs fssync|-y <path> btrfs resize|-z [+/-]<size>[gkm]|max <filesystem> btrfs scan|-n [<device> [<device>..]] btrfs show|-l <dev>|<label> [<dev>|<label>...] btrfs balance|-b <path> btrfs add-dev|-A <dev> [<dev>..] <path> btrfs rm-dev|-R <dev> [<dev>..] <path> ] btrfs help|--help|-h DESCRIPTION btrfs is used to control the filesystem and the files and directories stored. It is the tool to create or destroy a new snapshot or a new subvolume for the filesystem, to defrag a file or a directory, to flush the dato to the disk, to resize the filesystem, to scan the device. OPTIONS snapshot|-s <source> [<dest>/]<name> Create a writeble snapshot of the subvolume <source> with the name <name> in the <dest> directory. If <source> is not a sub‐ volume, btrfs returns an error. delete|-D <subvolume> Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ volume, btrfs returns an error. subvolume|-c [<dest>/]<name> Create a subvolume in <dest> (or in the current directory if <dest> is not passed). defrag|-f <file>|<dir> [<file>|<dir>...] Defragment files and/or directories. scan|-n [<device> [<device>..]] Scan devices for a btrfs filesystem. If no devices are passed, btrfs scans all the block devices. fssync|-y <path> Force a sync for the filesystem identified by <path>. resize|-z [+/-]<size>[gkm]|max <filesystem> Resize a file system identified by <path>. The <size> parameter specifies the new size of the filesystem. If the prefix + or - is present the size is increased or decreased by the quantity <size>. If no units are specified, the unit of the <size> parameter is the byte. Optionally, the size parameter may be suffixed by one of the following the units designators: ''K'', ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. If ''max'' is passed, the filesystem will occupy all available space on the volume(s). The resize command does not manipulate the size of underlying partitions. If you wish to enlarge/reduce a filesystem, you must make sure you can expand/reduce the size of the partition also. show|-l [<dev>|<label>...] Show the btrfs devices with some additional info. If no devices or labels are passed, btrfs scans all the block devices. balance|-b <path> Balance the chunk of the filesystem identified by <path> across the devices. add-dev|-A <dev> [<dev>..] <path> Add device(s) to the filesystem identified by <path>. rm-dev|-R <dev> [<dev>..] <path> Remove device(s) to the filesystem identified by <path>. EXIT STATUS btrf returns a zero exist status if it succeeds. Non zero is returned in case of failure. AVAILABILITY btrfs is part of btrfs-progs. Btrfs filesystem is currently under heavy development, and not suitable for any uses other than benchmarking and review. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for further details. SEE ALSO mkfs.btrfs(8) btrfs BTRFS(8) -- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 -- 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
Andreas Philipp
2010-Feb-17 20:48 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
Hi, Cool tool. Just looking at the help output on the console I found a small typo. Kind regards, Andreas Philipp diff --git a/btrfs.c b/btrfs.c index cc55599..f3e5d8d 100644 --- a/btrfs.c +++ b/btrfs.c @@ -633,7 +633,7 @@ static struct Command commands[] = { "Add a device to a filesystem" }, { -1, "rm-dev", "-R", "<dev> [<dev>..] <path>\n" - "Remove a device to a filesystem" + "Remove a device from a filesystem" }, /* coming soon { 2, "label", "-m", "<label> <path>\n" On 17.02.2010 21:02, Goffredo Baroncelli wrote:> Hi all, > > enclosed in the next two emails you can find two patches which introduce a new > program called "btrfs". This program has the ambitious to replace the > utilities of the btrfs-prog package, like: > - btrfsctl > - btrfs-show > - btrfs-volume > - btrfs > > The goals are: > - improve the usability of the tools > - add a man page which documents all the commands > - correct the btrfsctl return codes > > I put a lot of attentions in order to avoid regression respect the old tools. > A clone of my git repository is available at > > http://cassiopea.homelinux.net/git/btrfs-command.git > > On the basis of the feedback of the previous patches I rearranged some "short > command name" (-s, -c ...) in order to avoid collision. I renamed also the > command "create" in "subvolume" (and the relative short command name from ''-S'' > to ''-c'' :-) ). > > Chris, do you think that these patches are mergeable ? > > Comments are welcome. > > BR > Goffredo > --- > > Makefile | 5 > btrfs.c | 775 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > man/Makefile | 5 > man/btrfs.8.in | 122 ++++++++ > 4 files changed, 905 insertions(+), 2 deletions(-) > > -- > > Example of use: > $ btrfs > Usage: > btrfs snapshot|-s [<dest>/]<name> > Create a writeble snapshot of the subvolume <source> with > the name <name> in the <dest> directory. > btrfs delete|-D <subvolume> > Delete the subvolume <subvolume>. > btrfs subvolume|-c [<dest>/]<name> > Create a subvolume in <dest> (or the current directory if > not passed). > btrfs defrag|-f <file>|<dir> [<file>|<dir>...] > Defragment a file or a directory. > btrfs scan|-n [<device> [<device>..] > Scan all device for or the passed device for a btrfs > filesystem. > btrfs fssync|-y <path> > Force a fs sync on the filesystem <path> > btrfs resize|-z [+/-]<newsize>[gkm]|max <filesystem> > Resize the file system. If ''max'' is passed, the filesystem > will occupe all available space on the device. > btrfs show|-l [<dev>|<label>...] > Show the btrfs devices > btrfs balance|-b <path> > Balance the chunk across the device > btrfs add-dev|-A <dev> [<dev>..] <path> > Add a device to a filesystem > btrfs rm-dev|-R <dev> [<dev>..] <path> > Remove a device to a filesystem > > btrfs help|--help|-h > Show the help. > > Btrfs v0.19-12-g7e4c8e8-dirty > > > > > BTRFS(8) btrfs BTRFS(8) > > > > NAME > btrfs - control a btrfs filesystem > > SYNOPSIS > btrfs snapshot|-s <source> [<dest>/]<name> > > btrfs delete|-D <subvolume> > > btrfs subvolume|-c [<dest>/]<name> > > btrfs defrag|-f <file>|<dir> [<file>|<dir>...] > > btrfs fssync|-y <path> > > btrfs resize|-z [+/-]<size>[gkm]|max <filesystem> > > btrfs scan|-n [<device> [<device>..]] > > btrfs show|-l <dev>|<label> [<dev>|<label>...] > > btrfs balance|-b <path> > > btrfs add-dev|-A <dev> [<dev>..] <path> > > btrfs rm-dev|-R <dev> [<dev>..] <path> ] > > > btrfs help|--help|-h > > DESCRIPTION > btrfs is used to control the filesystem and the files and directories > stored. It is the tool to create or destroy a new snapshot or a new > subvolume for the filesystem, to defrag a file or a directory, to flush > the dato to the disk, to resize the filesystem, to scan the device. > > > OPTIONS > snapshot|-s <source> [<dest>/]<name> > Create a writeble snapshot of the subvolume <source> with the > name <name> in the <dest> directory. If <source> is not a sub‐ > volume, btrfs returns an error. > > > delete|-D <subvolume> > Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ > volume, btrfs returns an error. > > > subvolume|-c [<dest>/]<name> > Create a subvolume in <dest> (or in the current directory if > <dest> is not passed). > > > defrag|-f <file>|<dir> [<file>|<dir>...] > Defragment files and/or directories. > > > scan|-n [<device> [<device>..]] > Scan devices for a btrfs filesystem. If no devices are passed, > btrfs scans all the block devices. > > > fssync|-y <path> > Force a sync for the filesystem identified by <path>. > > > > resize|-z [+/-]<size>[gkm]|max <filesystem> > Resize a file system identified by <path>. The <size> parameter > specifies the new size of the filesystem. If the prefix + or - > is present the size is increased or decreased by the quantity > <size>. If no units are specified, the unit of the <size> > parameter is the byte. Optionally, the size parameter may be > suffixed by one of the following the units designators: ''K'', > ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. > > If ''max'' is passed, the filesystem will occupy all available > space on the volume(s). > > The resize command does not manipulate the size of underlying > partitions. If you wish to enlarge/reduce a filesystem, you > must make sure you can expand/reduce the size of the partition > also. > > > show|-l [<dev>|<label>...] > Show the btrfs devices with some additional info. If no devices > or labels are passed, btrfs scans all the block devices. > > > balance|-b <path> > Balance the chunk of the filesystem identified by <path> across > the devices. > > > add-dev|-A <dev> [<dev>..] <path> > Add device(s) to the filesystem identified by <path>. > > > rm-dev|-R <dev> [<dev>..] <path> > Remove device(s) to the filesystem identified by <path>. > > EXIT STATUS > btrf returns a zero exist status if it succeeds. Non zero is returned > in case of failure. > > > AVAILABILITY > btrfs is part of btrfs-progs. Btrfs filesystem is currently under heavy > development, and not suitable for any uses other than benchmarking and > review. Please refer to the btrfs wiki http://btrfs.wiki.kernel.org > for further details. > > SEE ALSO > mkfs.btrfs(8) > > > > btrfs BTRFS(8) > >-- 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
Goffredo Baroncelli
2010-Feb-17 21:00 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Wednesday 17 February 2010, you (Andreas Philipp) wrote:> > Andreas Philipp <philipp.andreas@gmail.com>Thank you, I corrected my source and updated the changes to the public repository. -- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 -- 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
Mike Fedyk
2010-Feb-17 23:35 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
I think he need some command hierarchy here. On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli <kreijack@gmail.com> wrote:> OPTIONS > snapshot|-s <source> [<dest>/]<name> > Create a writeble snapshot of the subvolume <source> with the > name <name> in the <dest> directory. If <source> is not a sub‐ > volume, btrfs returns an error.This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.> > > delete|-D <subvolume> > Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ > volume, btrfs returns an error. >This becomes: btrfs subvolume delete <subvolume> This works with snapshots as well.> > subvolume|-c [<dest>/]<name> > Create a subvolume in <dest> (or in the current directory if > <dest> is not passed).btrfs subvolume create [<dest>/]<name>> > > defrag|-f <file>|<dir> [<file>|<dir>...] > Defragment files and/or directories.This will defrag individual files? Does it defrag a directory tree? Does it defrag a subvolume? Does it defrag a pool?> > > scan|-n [<device> [<device>..]] > Scan devices for a btrfs filesystem. If no devices are passed, > btrfs scans all the block devices.btrfs pool scan [<device> [<device>..]]> > > fssync|-y <path> > Force a sync for the filesystem identified by <path>. >Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be: btrfs subvolume sync <path>> > > resize|-z [+/-]<size>[gkm]|max <filesystem> > Resize a file system identified by <path>. The <size> parameter > specifies the new size of the filesystem. If the prefix + or - > is present the size is increased or decreased by the quantity > <size>. If no units are specified, the unit of the <size> > parameter is the byte. Optionally, the size parameter may be > suffixed by one of the following the units designators: ''K'', > ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. > > If ''max'' is passed, the filesystem will occupy all available > space on the volume(s). > > The resize command does not manipulate the size of underlying > partitions. If you wish to enlarge/reduce a filesystem, you > must make sure you can expand/reduce the size of the partition > also. >This works with physical devices, not a pool or subvolume. I get the name "physical volume" from lvm. Also I think it should resize to max without arguments, in order to do that, the size argument would need to be the last argument. It becomes: btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> Or: btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]> > show|-l [<dev>|<label>...] > Show the btrfs devices with some additional info. If no devices > or labels are passed, btrfs scans all the block devices.This becomes: btrfs pool show [<dev>|<label>...]> > > balance|-b <path> > Balance the chunk of the filesystem identified by <path> across > the devices.Is path to one of the block devices in the pool? This becomes: btrfs pool balance <path>> > > add-dev|-A <dev> [<dev>..] <path> > Add device(s) to the filesystem identified by <path>.What is path? Somewhere the pool is mounted? The root of where the pool is mounted? this becomes: btrfs pvolume add <dev> [<dev>..] <path>> > > rm-dev|-R <dev> [<dev>..] <path> > Remove device(s) to the filesystem identified by <path>.(same questions as with add) This becomes: btrfs pvolume remove <dev> [<dev>..] <path> Mike -- 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
Piavlo
2010-Feb-18 09:45 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
Hi, I agree with Mike, it''s just much much more pleasant and intuitive to work with the hierarchyial cli he suggests. Alex Mike Fedyk wrote:> I think he need some command hierarchy here. > > On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli > <kreijack@gmail.com> wrote: > >> OPTIONS >> snapshot|-s <source> [<dest>/]<name> >> Create a writeble snapshot of the subvolume <source> with the >> name <name> in the <dest> directory. If <source> is not a sub‐ >> volume, btrfs returns an error. >> > > This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". > It only works on subvolumes. > > >> delete|-D <subvolume> >> Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ >> volume, btrfs returns an error. >> >> > > This becomes: > > btrfs subvolume delete <subvolume> > > This works with snapshots as well. > > >> subvolume|-c [<dest>/]<name> >> Create a subvolume in <dest> (or in the current directory if >> <dest> is not passed). >> > > btrfs subvolume create [<dest>/]<name> > > >> defrag|-f <file>|<dir> [<file>|<dir>...] >> Defragment files and/or directories. >> > > This will defrag individual files? Does it defrag a directory tree? > Does it defrag a subvolume? Does it defrag a pool? > > >> scan|-n [<device> [<device>..]] >> Scan devices for a btrfs filesystem. If no devices are passed, >> btrfs scans all the block devices. >> > > btrfs pool scan [<device> [<device>..]] > > >> fssync|-y <path> >> Force a sync for the filesystem identified by <path>. >> >> > > Does it sync a pool or subvolume? Assuming it works against > subvolumes, it would be: > > btrfs subvolume sync <path> > > >> resize|-z [+/-]<size>[gkm]|max <filesystem> >> Resize a file system identified by <path>. The <size> parameter >> specifies the new size of the filesystem. If the prefix + or - >> is present the size is increased or decreased by the quantity >> <size>. If no units are specified, the unit of the <size> >> parameter is the byte. Optionally, the size parameter may be >> suffixed by one of the following the units designators: ''K'', >> ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. >> >> If ''max'' is passed, the filesystem will occupy all available >> space on the volume(s). >> >> The resize command does not manipulate the size of underlying >> partitions. If you wish to enlarge/reduce a filesystem, you >> must make sure you can expand/reduce the size of the partition >> also. >> >> > > This works with physical devices, not a pool or subvolume. I get the > name "physical volume" from lvm. Also I think it should resize to max > without arguments, in order to do that, the size argument would need > to be the last argument. > > It becomes: > > btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> > > Or: > > btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]] > > >> show|-l [<dev>|<label>...] >> Show the btrfs devices with some additional info. If no devices >> or labels are passed, btrfs scans all the block devices. >> > > This becomes: > > btrfs pool show [<dev>|<label>...] > > >> balance|-b <path> >> Balance the chunk of the filesystem identified by <path> across >> the devices. >> > > Is path to one of the block devices in the pool? > > This becomes: > > btrfs pool balance <path> > > >> add-dev|-A <dev> [<dev>..] <path> >> Add device(s) to the filesystem identified by <path>. >> > > What is path? Somewhere the pool is mounted? The root of where the > pool is mounted? > > this becomes: > > btrfs pvolume add <dev> [<dev>..] <path> > > >> rm-dev|-R <dev> [<dev>..] <path> >> Remove device(s) to the filesystem identified by <path>. >> > > (same questions as with add) > > This becomes: > > btrfs pvolume remove <dev> [<dev>..] <path> > > Mike > -- > 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 >-- 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
Chris Mason
2010-Feb-18 16:58 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
I do like the subcommand method, more details below. On Wed, Feb 17, 2010 at 03:35:26PM -0800, Mike Fedyk wrote:> I think he need some command hierarchy here. > > On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli > <kreijack@gmail.com> wrote: > > OPTIONS > > snapshot|-s <source> [<dest>/]<name> > > Create a writeble snapshot of the subvolume <source> with the > > name <name> in the <dest> directory. If <source> is not a sub‐ > > volume, btrfs returns an error. > > This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". > It only works on subvolumes.If we can type subvol instead of subvolume I like it. Basically the perl/python arg parsing system where any short form of the command that uniquely matches it is allowed. We keep the long forms but allow the user to pick a shorter form if it isn''t ambiguous.> > > > > > > delete|-D <subvolume> > > Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ > > volume, btrfs returns an error. > > > > This becomes: > > btrfs subvolume delete <subvolume>subvol del (same as above).> > This works with snapshots as well. > > > > > subvolume|-c [<dest>/]<name> > > Create a subvolume in <dest> (or in the current directory if > > <dest> is not passed). > > btrfs subvolume create [<dest>/]<name> > > > > > > > defrag|-f <file>|<dir> [<file>|<dir>...] > > Defragment files and/or directories. > > This will defrag individual files? Does it defrag a directory tree? > Does it defrag a subvolume? Does it defrag a pool?For now lets change this to only do files. That''s the only thing the tool supports today.> > > > > > > scan|-n [<device> [<device>..]] > > Scan devices for a btrfs filesystem. If no devices are passed, > > btrfs scans all the block devices. > > btrfs pool scan [<device> [<device>..]]Instead of btrfs pool, please use btrfs dev> > > > > > > fssync|-y <path> > > Force a sync for the filesystem identified by <path>. > > > > Does it sync a pool or subvolume? Assuming it works against > subvolumes, it would be: > > btrfs subvolume sync <path> > > > > > > > resize|-z [+/-]<size>[gkm]|max <filesystem> > > Resize a file system identified by <path>. The <size> parameter > > specifies the new size of the filesystem. If the prefix + or - > > is present the size is increased or decreased by the quantity > > <size>. If no units are specified, the unit of the <size> > > parameter is the byte. Optionally, the size parameter may be > > suffixed by one of the following the units designators: ''K'', > > ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. > > > > If ''max'' is passed, the filesystem will occupy all available > > space on the volume(s). > > > > The resize command does not manipulate the size of underlying > > partitions. If you wish to enlarge/reduce a filesystem, you > > must make sure you can expand/reduce the size of the partition > > also. > > > > This works with physical devices, not a pool or subvolume. I get the > name "physical volume" from lvm. Also I think it should resize to max > without arguments, in order to do that, the size argument would need > to be the last argument.We don''t have physical volumes and logical volumes the way lvm does, so I''d like to avoid the pvolume theme.> > It becomes: > > btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> > > Or: > > btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]btrfs dev resize> > > > > show|-l [<dev>|<label>...] > > Show the btrfs devices with some additional info. If no devices > > or labels are passed, btrfs scans all the block devices. > > This becomes: > > btrfs pool show [<dev>|<label>...]btrfs dev show> > > > > > > balance|-b <path> > > Balance the chunk of the filesystem identified by <path> across > > the devices. > > Is path to one of the block devices in the pool? > > This becomes: > > btrfs pool balance <path>btrfs dev balance> > > > > > > add-dev|-A <dev> [<dev>..] <path> > > Add device(s) to the filesystem identified by <path>. > > What is path? Somewhere the pool is mounted? The root of where the > pool is mounted?The path just tells us which filesystem to work against. It can really be any path inside the mount point.> > this becomes: > > btrfs pvolume add <dev> [<dev>..] <path>btrfs dev add> > > > > > > rm-dev|-R <dev> [<dev>..] <path> > > Remove device(s) to the filesystem identified by <path>. > > (same questions as with add) > > This becomes: > > btrfs pvolume remove <dev> [<dev>..] <path>btrfs dev remove -chris -- 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
Mike Fedyk
2010-Feb-18 17:58 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thu, Feb 18, 2010 at 8:58 AM, Chris Mason <chris.mason@oracle.com> wrote:> I do like the subcommand method, more details below. > > On Wed, Feb 17, 2010 at 03:35:26PM -0800, Mike Fedyk wrote: >> I think he need some command hierarchy here. >> >> On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli >> <kreijack@gmail.com> wrote: >> > OPTIONS >> > snapshot|-s <source> [<dest>/]<name> >> > Create a writeble snapshot of the subvolume <source> with the >> > name <name> in the <dest> directory. If <source> is not a sub‐ >> > volume, btrfs returns an error. >> >> This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". >> It only works on subvolumes. > > If we can type subvol instead of subvolume I like it. Basically the > perl/python arg parsing system where any short form of the command that > uniquely matches it is allowed. > > We keep the long forms but allow the user to pick a shorter form if it > isn''t ambiguous. >Yes, I agree. This is why I compared it with the ip command which does the same.>> >> > >> > >> > delete|-D <subvolume> >> > Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ >> > volume, btrfs returns an error. >> > >> >> This becomes: >> >> btrfs subvolume delete <subvolume> > > subvol del (same as above). > >> >> This works with snapshots as well. >> >> > >> > subvolume|-c [<dest>/]<name> >> > Create a subvolume in <dest> (or in the current directory if >> > <dest> is not passed). >> >> btrfs subvolume create [<dest>/]<name> >> >> > >> > >> > defrag|-f <file>|<dir> [<file>|<dir>...] >> > Defragment files and/or directories. >> >> This will defrag individual files? Does it defrag a directory tree? >> Does it defrag a subvolume? Does it defrag a pool? > > For now lets change this to only do files. That''s the only thing the > tool supports today. > >> >> > >> > >> > scan|-n [<device> [<device>..]] >> > Scan devices for a btrfs filesystem. If no devices are passed, >> > btrfs scans all the block devices. >> >> btrfs pool scan [<device> [<device>..]] > > Instead of btrfs pool, please use btrfs dev > >> >> > >> > >> > fssync|-y <path> >> > Force a sync for the filesystem identified by <path>. >> > >> >> Does it sync a pool or subvolume? Assuming it works against >> subvolumes, it would be: >> >> btrfs subvolume sync <path> >> >> > >> > >> > resize|-z [+/-]<size>[gkm]|max <filesystem> >> > Resize a file system identified by <path>. The <size> parameter >> > specifies the new size of the filesystem. If the prefix + or - >> > is present the size is increased or decreased by the quantity >> > <size>. If no units are specified, the unit of the <size> >> > parameter is the byte. Optionally, the size parameter may be >> > suffixed by one of the following the units designators: ''K'', >> > ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. >> > >> > If ''max'' is passed, the filesystem will occupy all available >> > space on the volume(s). >> > >> > The resize command does not manipulate the size of underlying >> > partitions. If you wish to enlarge/reduce a filesystem, you >> > must make sure you can expand/reduce the size of the partition >> > also. >> > >> >> This works with physical devices, not a pool or subvolume. I get the >> name "physical volume" from lvm. Also I think it should resize to max >> without arguments, in order to do that, the size argument would need >> to be the last argument. > > We don''t have physical volumes and logical volumes the way lvm does, so > I''d like to avoid the pvolume theme. > >> >> It becomes: >> >> btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> >> >> Or: >> >> btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]] > > btrfs dev resize >Dev works for me, I could only think of the lvm terms at the time. -- 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
Thomas Kupper
2010-Feb-18 18:20 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
I''m happy that I''m not alone with my preference for subcommands :) over short -<one-letter> commands. Btw: I think it would be a good idea start from the beginning with a ''libbtrfs'' library and a corresponding API. That way integrating into other languages like Python and integration into tools like parted (or libparted) would be quite easy. On 18 Feb 2010, at 18:58, Mike Fedyk wrote:> On Thu, Feb 18, 2010 at 8:58 AM, Chris Mason <chris.mason@oracle.com> wrote: >> I do like the subcommand method, more details below. >> >> On Wed, Feb 17, 2010 at 03:35:26PM -0800, Mike Fedyk wrote: >>> I think he need some command hierarchy here. >>> >>> On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli >>> <kreijack@gmail.com> wrote: >>>> OPTIONS >>>> snapshot|-s <source> [<dest>/]<name> >>>> Create a writeble snapshot of the subvolume <source> with the >>>> name <name> in the <dest> directory. If <source> is not a sub‐ >>>> volume, btrfs returns an error. >>> >>> This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". >>> It only works on subvolumes. >> >> If we can type subvol instead of subvolume I like it. Basically the >> perl/python arg parsing system where any short form of the command that >> uniquely matches it is allowed. >> >> We keep the long forms but allow the user to pick a shorter form if it >> isn''t ambiguous. >> > > Yes, I agree. This is why I compared it with the ip command which > does the same. > >>> >>>> >>>> >>>> delete|-D <subvolume> >>>> Delete the subvolume <subvolume>. If <subvolume> is not a sub‐ >>>> volume, btrfs returns an error. >>>> >>> >>> This becomes: >>> >>> btrfs subvolume delete <subvolume> >> >> subvol del (same as above). >> >>> >>> This works with snapshots as well. >>> >>>> >>>> subvolume|-c [<dest>/]<name> >>>> Create a subvolume in <dest> (or in the current directory if >>>> <dest> is not passed). >>> >>> btrfs subvolume create [<dest>/]<name> >>> >>>> >>>> >>>> defrag|-f <file>|<dir> [<file>|<dir>...] >>>> Defragment files and/or directories. >>> >>> This will defrag individual files? Does it defrag a directory tree? >>> Does it defrag a subvolume? Does it defrag a pool? >> >> For now lets change this to only do files. That''s the only thing the >> tool supports today. >> >>> >>>> >>>> >>>> scan|-n [<device> [<device>..]] >>>> Scan devices for a btrfs filesystem. If no devices are passed, >>>> btrfs scans all the block devices. >>> >>> btrfs pool scan [<device> [<device>..]] >> >> Instead of btrfs pool, please use btrfs dev >> >>> >>>> >>>> >>>> fssync|-y <path> >>>> Force a sync for the filesystem identified by <path>. >>>> >>> >>> Does it sync a pool or subvolume? Assuming it works against >>> subvolumes, it would be: >>> >>> btrfs subvolume sync <path> >>> >>>> >>>> >>>> resize|-z [+/-]<size>[gkm]|max <filesystem> >>>> Resize a file system identified by <path>. The <size> parameter >>>> specifies the new size of the filesystem. If the prefix + or - >>>> is present the size is increased or decreased by the quantity >>>> <size>. If no units are specified, the unit of the <size> >>>> parameter is the byte. Optionally, the size parameter may be >>>> suffixed by one of the following the units designators: ''K'', >>>> ''M'', or ''G'', kilobytes, megabytes, or gigabytes, respectively. >>>> >>>> If ''max'' is passed, the filesystem will occupy all available >>>> space on the volume(s). >>>> >>>> The resize command does not manipulate the size of underlying >>>> partitions. If you wish to enlarge/reduce a filesystem, you >>>> must make sure you can expand/reduce the size of the partition >>>> also. >>>> >>> >>> This works with physical devices, not a pool or subvolume. I get the >>> name "physical volume" from lvm. Also I think it should resize to max >>> without arguments, in order to do that, the size argument would need >>> to be the last argument. >> >> We don''t have physical volumes and logical volumes the way lvm does, so >> I''d like to avoid the pvolume theme. >> >>> >>> It becomes: >>> >>> btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> >>> >>> Or: >>> >>> btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]] >> >> btrfs dev resize >> > > Dev works for me, I could only think of the lvm terms at the time.-- 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
Goffredo Baroncelli
2010-Feb-18 19:59 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thursday 18 February 2010, Chris Mason wrote:> I do like the subcommand method, more details below. >I try to summarise your suggestions. But there are some cases not to clear for me. I grouped the commands in three categories: subvolume, devices, and filesystem. devices scan devices show devices balance devices add devices remove subvolume snapshot subvolume delete subvolume create [subvolume list] filesystem resize [filesystem label] ??? defrag ??? sync For the first two categories both Chris and Mike agreed; but IMHO there are some commands that don''t fit nor in devices, nor subvolume, like resize (we resize a filesystem) and label (not available now). I don''t know how classify defrag (per file / directory level ?) and sync (filesystem ?) An option is to consider commands without classification. For examples: $ btrfs subvolume create [path/]<subvolname> $ btrfs sync <path> $ btrfs defrag <file> Any comments and/or suggestions ?> On Wed, Feb 17, 2010 at 03:35:26PM -0800, Mike Fedyk wrote: > > I think he need some command hierarchy here. > > > > On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli > > <kreijack@gmail.com> wrote: > > > OPTIONS > > > snapshot|-s <source> [<dest>/]<name> > > > Create a writeble snapshot of the subvolume <source> withthe> > > name <name> in the <dest> directory. If <source> is not asub‐> > > volume, btrfs returns an error. > > > > This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". > > It only works on subvolumes. > > If we can type subvol instead of subvolume I like it. Basically the > perl/python arg parsing system where any short form of the command that > uniquely matches it is allowed. > > We keep the long forms but allow the user to pick a shorter form if it > isn''t ambiguous. > > > > > > > > > > > > delete|-D <subvolume> > > > Delete the subvolume <subvolume>. If <subvolume> is not asub‐> > > volume, btrfs returns an error. > > > > > > > This becomes: > > > > btrfs subvolume delete <subvolume> > > subvol del (same as above). > > > > > This works with snapshots as well. > > > > > > > > subvolume|-c [<dest>/]<name> > > > Create a subvolume in <dest> (or in the currentdirectory if> > > <dest> is not passed). > > > > btrfs subvolume create [<dest>/]<name> > > > > > > > > > > > defrag|-f <file>|<dir> [<file>|<dir>...] > > > Defragment files and/or directories. > > > > This will defrag individual files? Does it defrag a directory tree? > > Does it defrag a subvolume? Does it defrag a pool? > > For now lets change this to only do files. That''s the only thing the > tool supports today. > > > > > > > > > > > > scan|-n [<device> [<device>..]] > > > Scan devices for a btrfs filesystem. If no devices arepassed,> > > btrfs scans all the block devices. > > > > btrfs pool scan [<device> [<device>..]] > > Instead of btrfs pool, please use btrfs dev > > > > > > > > > > > > fssync|-y <path> > > > Force a sync for the filesystem identified by <path>. > > > > > > > Does it sync a pool or subvolume? Assuming it works against > > subvolumes, it would be: > > > > btrfs subvolume sync <path> > > > > > > > > > > > resize|-z [+/-]<size>[gkm]|max <filesystem> > > > Resize a file system identified by <path>. The <size>parameter> > > specifies the new size of the filesystem. If the prefix +or -> > > is present the size is increased or decreased by thequantity> > > <size>. If no units are specified, the unit of the<size>> > > parameter is the byte. Optionally, the size parametermay be> > > suffixed by one of the following the units designators:''K'',> > > ''M'', or ''G'', kilobytes, megabytes, or gigabytes,respectively.> > > > > > If ''max'' is passed, the filesystem will occupy allavailable> > > space on the volume(s). > > > > > > The resize command does not manipulate the size ofunderlying> > > partitions. If you wish to enlarge/reduce afilesystem, you> > > must make sure you can expand/reduce the size of thepartition> > > also. > > > > > > > This works with physical devices, not a pool or subvolume. I get the > > name "physical volume" from lvm. Also I think it should resize to max > > without arguments, in order to do that, the size argument would need > > to be the last argument. > > We don''t have physical volumes and logical volumes the way lvm does, so > I''d like to avoid the pvolume theme. > > > > > It becomes: > > > > btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> > > > > Or: > > > > btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]] > > btrfs dev resize > > > > > > > > > show|-l [<dev>|<label>...] > > > Show the btrfs devices with some additional info. If nodevices> > > or labels are passed, btrfs scans all the block devices. > > > > This becomes: > > > > btrfs pool show [<dev>|<label>...] > > btrfs dev show > > > > > > > > > > > > balance|-b <path> > > > Balance the chunk of the filesystem identified by <path>across> > > the devices. > > > > Is path to one of the block devices in the pool? > > > > This becomes: > > > > btrfs pool balance <path> > > btrfs dev balance > > > > > > > > > > > > add-dev|-A <dev> [<dev>..] <path> > > > Add device(s) to the filesystem identified by <path>. > > > > What is path? Somewhere the pool is mounted? The root of where the > > pool is mounted? > > The path just tells us which filesystem to work against. It can really > be any path inside the mount point. > > > > > this becomes: > > > > btrfs pvolume add <dev> [<dev>..] <path> > > btrfs dev add > > > > > > > > > > > rm-dev|-R <dev> [<dev>..] <path> > > > Remove device(s) to the filesystem identified by <path>. > > > > (same questions as with add) > > > > This becomes: > > > > btrfs pvolume remove <dev> [<dev>..] <path> > > btrfs dev remove > > -chris > > -- > 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 >-- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 -- 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
Mike Fedyk
2010-Feb-18 20:46 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thu, Feb 18, 2010 at 11:59 AM, Goffredo Baroncelli <kreijack@gmail.com> wrote:> On Thursday 18 February 2010, Chris Mason wrote: >> I do like the subcommand method, more details below. >> > > I try to summarise your suggestions. But there are some cases not to clear for > me. > I grouped the commands in three categories: subvolume, devices, and > filesystem. > > > devices scan > devices show > devices balance > devices add > devices remove > > subvolume snapshot > subvolume delete > subvolume create > [subvolume list] > > filesystem resize > [filesystem label] > > ??? defrag > ??? sync > > > > For the first two categories both Chris and Mike agreed; but IMHO there are > some commands that don''t fit nor in devices, nor subvolume, like resize (we > resize a filesystem) and label (not available now). >A btrfs filesystem can span multiple devices. Resize resizes how big of a chunk of one device btrfs uses. This would be used by partitioning programs for instance. zfs uses the term "pool" instead of filesystem to solve this ambiguous use of the term "filesystem" since btrfs and zfs break people''s existing definition of the word "filesystem".> I don''t know how classify defrag (per file / directory level ?) and sync > (filesystem ?)It turns out that defrag is per file, which seems most cumbersome. Maybe since it will probably eventually work against several types of objects we could have: btrfs defrag file <file> btrfs defrag directory <directory> btrfs defrag subvol <subvol> btrfs defrag pool <pool>> > An option is to consider commands without classification. For examples: > > $ btrfs subvolume create [path/]<subvolname> > $ btrfs sync <path> > $ btrfs defrag <file>Maybe if the btrfs developers are agreeable, we could do this as well: btrfs sync file <file> btrfs sync directory <directory> btrfs sync subvol <subvol> btrfs sync pool <pool> I''m not sure how useful syncing the pool or a directory tree would be, but I''ll include it here for further discussion. Mike -- 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
Chris Mason
2010-Feb-18 20:58 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thu, Feb 18, 2010 at 12:46:56PM -0800, Mike Fedyk wrote:> On Thu, Feb 18, 2010 at 11:59 AM, Goffredo Baroncelli > <kreijack@gmail.com> wrote: > > On Thursday 18 February 2010, Chris Mason wrote: > >> I do like the subcommand method, more details below. > >> > > > > I try to summarise your suggestions. But there are some cases not to clear for > > me. > > I grouped the commands in three categories: subvolume, devices, and > > filesystem. > > > > > > devices scan > > devices show > > devices balance > > devices add > > devices remove > > > > subvolume snapshot > > subvolume delete > > subvolume create > > [subvolume list] > > > > filesystem resize > > [filesystem label] > > > > ??? defrag > > ??? sync > > > > > > > > For the first two categories both Chris and Mike agreed; but IMHO there are > > some commands that don''t fit nor in devices, nor subvolume, like resize (we > > resize a filesystem) and label (not available now). > > > > A btrfs filesystem can span multiple devices. Resize resizes how big > of a chunk of one device btrfs uses.Right, resize is actually always per device. When there is one device resizing the FS and the device are the same thing.> This would be used by > partitioning programs for instance. zfs uses the term "pool" instead > of filesystem to solve this ambiguous use of the term "filesystem" > since btrfs and zfs break people''s existing definition of the word > "filesystem". > > > I don''t know how classify defrag (per file / directory level ?) and sync > > (filesystem ?) > > It turns out that defrag is per file, which seems most cumbersome. > Maybe since it will probably eventually work against several types of > objects we could have: > > btrfs defrag file <file> > btrfs defrag directory <directory> > btrfs defrag subvol <subvol>I like these, although we don''t currently support the directory/subvol side. But we can leave the option open to add these later.> btrfs defrag pool <pool>I don''t think we''ll need defrag pool.> > > > > An option is to consider commands without classification. For examples: > > > > $ btrfs subvolume create [path/]<subvolname> > > $ btrfs sync <path> > > $ btrfs defrag <file> > > Maybe if the btrfs developers are agreeable, we could do this as well: > > btrfs sync file <file> > btrfs sync directory <directory>fsync on files and dirs already does this, we don''t need a btrfsctl for it.> btrfs sync subvol <subvol>btrfs sync subvol is nice.> btrfs sync pool <pool> >I don''t think we need sync pool. -chris -- 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
Goffredo Baroncelli
2010-Feb-18 21:00 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thursday 18 February 2010, Chris Mason wrote:> I do like the subcommand method, more details below. > > On Wed, Feb 17, 2010 at 03:35:26PM -0800, Mike Fedyk wrote: > > I think he need some command hierarchy here. > > > > On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli > > <kreijack@gmail.com> wrote: > > > OPTIONS > > > snapshot|-s <source> [<dest>/]<name> > > > Create a writeble snapshot of the subvolume <source> withthe> > > name <name> in the <dest> directory. If <source> is not asub‐> > > volume, btrfs returns an error. > > > > This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". > > It only works on subvolumes. > > If we can type subvol instead of subvolume I like it. Basically the > perl/python arg parsing system where any short form of the command that > uniquely matches it is allowed.So for you $ btrfs s s <source> <dest> is OK ? (''btrfs s s'' means btrfs subvolume snapshot)> We keep the long forms but allow the user to pick a shorter form if it > isn''t ambiguous.-- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 -- 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
Goffredo Baroncelli
2010-Feb-18 21:04 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thursday 18 February 2010, Chris Mason wrote:> On Thu, Feb 18, 2010 at 12:46:56PM -0800, Mike Fedyk wrote: > > On Thu, Feb 18, 2010 at 11:59 AM, Goffredo Baroncelli > > <kreijack@gmail.com> wrote: > > > On Thursday 18 February 2010, Chris Mason wrote: > > >> I do like the subcommand method, more details below. > > >> > > > > > > I try to summarise your suggestions. But there are some cases not toclear for> > > me. > > > I grouped the commands in three categories: subvolume, devices, and > > > filesystem. > > > > > > > > > devices scan > > > devices show > > > devices balance > > > devices add > > > devices remove > > > > > > subvolume snapshot > > > subvolume delete > > > subvolume create > > > [subvolume list] > > > > > > filesystem resize > > > [filesystem label] > > > > > > ??? defrag > > > ??? sync > > > > > > > > > > > > For the first two categories both Chris and Mike agreed; but IMHO thereare> > > some commands that don''t fit nor in devices, nor subvolume, like resize(we> > > resize a filesystem) and label (not available now). > > > > > > > A btrfs filesystem can span multiple devices. Resize resizes how big > > of a chunk of one device btrfs uses. > > Right, resize is actually always per device. When there is one device > resizing the FS and the device are the same thing. > > > This would be used by > > partitioning programs for instance. zfs uses the term "pool" instead > > of filesystem to solve this ambiguous use of the term "filesystem" > > since btrfs and zfs break people''s existing definition of the word > > "filesystem". > > > > > I don''t know how classify defrag (per file / directory level ?) and sync > > > (filesystem ?) > > > > It turns out that defrag is per file, which seems most cumbersome. > > Maybe since it will probably eventually work against several types of > > objects we could have: > > > > btrfs defrag file <file> > > btrfs defrag directory <directory> > > btrfs defrag subvol <subvol> > > I like these, although we don''t currently support the directory/subvol > side. But we can leave the option open to add these later.Sorry, but why: $ btrfs defrag subvol and not $ btrfs subvol defrag What do you want: $ btrfs <object> <action> or $ btrfs <action> <object> -- gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 -- 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
Tomasz Torcz
2010-Feb-18 21:25 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thu, Feb 18, 2010 at 12:46:56PM -0800, Mike Fedyk wrote:> btrfs defrag file <file> > btrfs defrag directory <directory> > btrfs defrag subvol <subvol> > btrfs defrag pool <pool>I think this could be implied by <target>, so it will be better to drop 3rd word: btrfs defrag /this/file btrfs defrag /mnt/btrfs/somedir/ btrfs defrag /dev/sda2 # for pool btrfs defrag LABEL="lnx-test" # for pool; libblkid integration is nice :) -- Tomasz Torcz "God, root, what''s the difference?" xmpp: zdzichubg@chrome.pl "God is more forgiving." -- 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
Mike Fedyk
2010-Feb-18 21:39 UTC
Re: [PATCH 0/2 V2] btrfs: a new tool to manage a btrfs filesystem
On Thu, Feb 18, 2010 at 12:58 PM, Chris Mason <chris.mason@oracle.com> wrote:> On Thu, Feb 18, 2010 at 12:46:56PM -0800, Mike Fedyk wrote: >> On Thu, Feb 18, 2010 at 11:59 AM, Goffredo Baroncelli >> <kreijack@gmail.com> wrote: >> > On Thursday 18 February 2010, Chris Mason wrote: >> >> I do like the subcommand method, more details below. >> >> >> > >> > I try to summarise your suggestions. But there are some cases not to clear for >> > me. >> > I grouped the commands in three categories: subvolume, devices, and >> > filesystem. >> > >> > >> > devices scan >> > devices show >> > devices balance >> > devices add >> > devices remove >> > >> > subvolume snapshot >> > subvolume delete >> > subvolume create >> > [subvolume list] >> > >> > filesystem resize >> > [filesystem label] >> > >> > ??? defrag >> > ??? sync >> > >> > >> > >> > For the first two categories both Chris and Mike agreed; but IMHO there are >> > some commands that don''t fit nor in devices, nor subvolume, like resize (we >> > resize a filesystem) and label (not available now). >> > >> >> A btrfs filesystem can span multiple devices. Resize resizes how big >> of a chunk of one device btrfs uses. > > Right, resize is actually always per device. When there is one device > resizing the FS and the device are the same thing. > >> This would be used by >> partitioning programs for instance. zfs uses the term "pool" instead >> of filesystem to solve this ambiguous use of the term "filesystem" >> since btrfs and zfs break people''s existing definition of the word >> "filesystem". >> >> > I don''t know how classify defrag (per file / directory level ?) and sync >> > (filesystem ?) >> >> It turns out that defrag is per file, which seems most cumbersome. >> Maybe since it will probably eventually work against several types of >> objects we could have: >> >> btrfs defrag file <file> >> btrfs defrag directory <directory> >> btrfs defrag subvol <subvol> > > I like these, although we don''t currently support the directory/subvol > side. But we can leave the option open to add these later. > >> btrfs defrag pool <pool> > > I don''t think we''ll need defrag pool. > >> >> > >> > An option is to consider commands without classification. For examples: >> > >> > $ btrfs subvolume create [path/]<subvolname> >> > $ btrfs sync <path> >> > $ btrfs defrag <file> >> >> Maybe if the btrfs developers are agreeable, we could do this as well: >> >> btrfs sync file <file> >> btrfs sync directory <directory> > > fsync on files and dirs already does this, we don''t need a btrfsctl for > it. >How do you fsync a file/dir from a shell script? Maybe that''s a generic tool that needs to be created...>> btrfs sync subvol <subvol> > > btrfs sync subvol is nice. > >> btrfs sync pool <pool> >> > > I don''t think we need sync pool. >I honestly can''t think of a use for it, but I''ll bet it''ll come in handy for some weird case while running on top of iscsi or some such topology. -- 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