Skip to contentSkip to conversation

btrfs: a new tool to manage a btrfs filesystem

PATCH In review Goffredo Baroncelli 7 participants 15 messages Feb 17, 2010 – Feb 18, 2010 Btrfs file system

lore
Share & tools
lore
#0 lore raw

v2 cover btrfs: a new tool to manage a btrfs filesystem

Hi all,

enclosed in the next two emails you can find two patches which introduc= e a new=20
program called "btrfs". This program has the ambitious to replace the=20 utilities of the btrfs-prog package, like:
- btrfsctl
- btrfs-show
- btrfs-volume
- btrfs

The goals are:
- improve the usability of the tools=20
- 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=20
command name" (-s, -c ...) in order to avoid collision. I renamed also = the=20
command "create" in "subvolume" (and the relative short command name fr= om '-S'=20
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> wi=
th
                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 filesys=
tem
                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 B=
TRFS(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 dire=
ctories
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, t=
o flush
the dato to the disk, to resize the filesystem, to scan the devi=
ce. =20

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source> wi=
th the
name <name> in the <dest> directory. If <source> is not=
a sub=E2=80=90
volume, btrfs returns an error. =
=20

delete|-D <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is not =
a sub=E2=80=90
volume, btrfs returns an error. =
=20

subvolume|-c [<dest>/]<name>
Create a subvolume in <dest> (or in the current direc=
tory if
<dest> is not passed). =
=20

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. =
=20

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> pa=
rameter
specifies the new size of the filesystem. If the prefix =
+ or -
is present the size is increased or decreased by the q=
uantity
<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, respecti=
vely. =20

If 'max' is passed, the filesystem will occupy all av=
ailable
space on the volume(s). =
=20

The resize command does not manipulate the size of und=
erlying
partitions. If you wish to enlarge/reduce a filesyst=
em, you
must make sure you can expand/reduce the size of the pa=
rtition

              also.                                                    =
      =20


       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 r=
eturned
in case of failure.

AVAILABILITY
btrfs is part of btrfs-progs. Btrfs filesystem is currently unde=
r heavy
development, and not suitable for any uses other than benchmark=
ing and
review. Please refer to the btrfs wiki http://btrfs.wiki.ker=
nel.org
for further details.

SEE ALSO

       mkfs.btrfs(8)

btrfs B=
TRFS(8)

--=20
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinw= ind.it>
Key fingerprint =3D 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Hi,

Cool tool.
Just looking at the help output on the console I found a small typo.

Kind regards,
Andreas Philipp

btrfs.c +1 -1
index cc55599..f3e5d8d 100644
@@ -633,7 +633,7 @@ static struct Command commands[] =3D {
                "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"
Quoted 3 lines · Goffredo Baroncelli

Hi all,

enclosed in the next two emails you can find two patches which introd=

uce a new=20

Quoted 1 line

program called "btrfs". This program has the ambitious to replace the=

=20

Quoted 6 lines

utilities of the btrfs-prog package, like:
- btrfsctl
- btrfs-show
- btrfs-volume
- btrfs

Quoted 6 lines

The goals are:
- improve the usability of the tools=20
- 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 ol=

d tools.

Quoted 5 lines

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 som=

e "short=20

Quoted 1 line

command name" (-s, -c ...) in order to avoid collision. I renamed als=

o the=20

Quoted 1 line

command "create" in "subvolume" (and the relative short command name =

from '-S'=20

Quoted 4 lines

to '-c' :-) ).

Chris, do you think that these patches are mergeable ?

Quoted 8 lines

Comments are welcome.

BR
Goffredo
---

 Makefile       |    5

btrfs.c | 775 ++++++++++++++++++++++++++++++++++++++++++++++=

+++++++

Quoted 11 lines
 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

Quoted 5 lines

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 director=

y if

Quoted 10 lines

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 files=

ystem

Quoted 13 lines

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.

Quoted 6 lines

Btrfs v0.19-12-g7e4c8e8-dirty

BTRFS(8) btrfs =

BTRFS(8)

Quoted 32 lines

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
Quoted 2 lines

DESCRIPTION
btrfs is used to control the filesystem and the files and di=

rectories

Quoted 1 line

stored. It is the tool to create or destroy a new snapshot o=

r a new

Quoted 1 line

subvolume for the filesystem, to defrag a file or a directory,=

to flush

Quoted 1 line

the dato to the disk, to resize the filesystem, to scan the de=

vice. =20

Quoted 5 lines

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source> =

with the

Quoted 1 line

name <name> in the <dest> directory. If <source> is n=

ot a sub=E2=80=90

Quoted 1 line

volume, btrfs returns an error. =

        =20
Quoted 4 lines

delete|-D <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is not=

a sub=E2=80=90

Quoted 1 line

volume, btrfs returns an error. =

        =20
Quoted 4 lines

subvolume|-c [<dest>/]<name>
Create a subvolume in <dest> (or in the current dir=

ectory if

Quoted 1 line

<dest> is not passed). =

        =20
Quoted 8 lines

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,

Quoted 1 line

btrfs scans all the block devices. =

        =20
Quoted 9 lines

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

Quoted 1 line

specifies the new size of the filesystem. If the prefi=

x + or -

Quoted 1 line

is present the size is increased or decreased by the=

quantity

Quoted 1 line

<size>. If no units are specified, the unit of th=

e <size>

Quoted 1 line

parameter is the byte. Optionally, the size paramet=

er may be

Quoted 1 line

suffixed by one of the following the units designato=

rs: 'K',

Quoted 1 line

'M', or 'G', kilobytes, megabytes, or gigabytes, respec=

tively. =20

Quoted 2 lines

If 'max' is passed, the filesystem will occupy all =

available

Quoted 1 line

space on the volume(s). =

        =20
Quoted 2 lines

The resize command does not manipulate the size of u=

nderlying

Quoted 1 line

partitions. If you wish to enlarge/reduce a filesy=

stem, you

Quoted 1 line

must make sure you can expand/reduce the size of the =

partition

Quoted 1 line

also. =

        =20
Quoted 4 lines

show|-l [<dev>|<label>...]
Show the btrfs devices with some additional info. If n=

o devices

Quoted 1 line

or labels are passed, btrfs scans all the block devices=

=2E

Quoted 8 lines

balance|-b <path>
Balance the chunk of the filesystem identified by <path=
across
the devices.

Quoted 6 lines

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>=

=2E

Quoted 3 lines

EXIT STATUS
btrf returns a zero exist status if it succeeds. Non zero is=

returned

Quoted 5 lines

in case of failure.

AVAILABILITY
btrfs is part of btrfs-progs. Btrfs filesystem is currently un=

der heavy

Quoted 1 line

development, and not suitable for any uses other than benchma=

rking and

Quoted 1 line

review. Please refer to the btrfs wiki http://btrfs.wiki.k=

ernel.org

Quoted 8 lines

for further details.

SEE ALSO

       mkfs.btrfs(8)

btrfs =

BTRFS(8)

Quoted 2 lines

=20

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 2 lines · you (Andreas Philipp)

Andreas Philipp <[email protected]>

Thank you, I corrected my source and updated the changes to the public repository.

Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
#3 lore raw
In reply to Goffredo Baroncelli

I think he need some command hierarchy here.

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
=C2=A0 =C2=A0 =C2=A0 snapshot|-s <source> [<dest>/]<name> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create a writeble sna=

pshot of the subvolume =C2=A0<source> =C2=A0with =C2=A0the

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0name =C2=A0<name> =C2=

=A0in the <dest> directory. If <source> is not a sub=E2=80=90

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs returns=

an error.

This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 delete|-D <subvolume>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Delete the subvolume =

<subvolume>. If <subvolume> is not =C2=A0a =C2=A0sub=E2=80=90

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs returns=

an error.

Quoted 1 line

This becomes:

btrfs subvolume delete <subvolume>

This works with snapshots as well.

Quoted 3 lines

=C2=A0 =C2=A0 =C2=A0 subvolume|-c [<dest>/]<name>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create =C2=A0a =C2=A0=

subvolume =C2=A0in =C2=A0<dest> (or in the current directory if

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<dest> is not passed)=

=2E

btrfs subvolume create [<dest>/]<name>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 defrag|-f <file>|<dir> [<file>|<dir>...] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Defragment 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?

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 scan|-n [<device> [<device>..]]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Scan devices for a bt=

rfs filesystem. If no devices =C2=A0are =C2=A0passed,

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0btrfs scans all the b=

lock devices.

btrfs pool scan [<device> [<device>..]]

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 fssync|-y <path>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Force a sync for the =

filesystem identified by <path>.

Quoted 1 line

Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be:

btrfs subvolume sync <path>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 resize|-z [+/-]<size>[gkm]|max <filesystem> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Resize a file system =

identified by <path>. =C2=A0The <size> parameter

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0specifies the new siz=

e of the filesystem. =C2=A0If the prefix + or =C2=A0-

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is =C2=A0present =C2=A0=

the =C2=A0size is increased or decreased by the quantity

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<size>. =C2=A0If no u=

nits are =C2=A0specified, =C2=A0the =C2=A0unit =C2=A0of =C2=A0the =C2=A0= <size>

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parameter =C2=A0is =C2=

=A0the =C2=A0byte. =C2=A0Optionally, the size parameter may be

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suffixed by one of th=

e following =C2=A0the =C2=A0units =C2=A0designators: =C2=A0'K',

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'M', or 'G', kilobyte=

s, megabytes, or gigabytes, respectively.

Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0If =C2=A0'max' =C2=A0=

is =C2=A0passed, =C2=A0the filesystem will occupy all available

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0space on the volume(s=

).

Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The resize command do=

es not manipulate the =C2=A0size =C2=A0of =C2=A0underlying

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0partitions. =C2=A0 If=

=C2=A0you =C2=A0wish =C2=A0to enlarge/reduce a filesystem, you

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0must make sure you ca=

n expand/reduce the size of =C2=A0the =C2=A0partition

Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0also.

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]]

Quoted 3 lines

=C2=A0 =C2=A0 =C2=A0 show|-l [<dev>|<label>...]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Show =C2=A0the btrfs =

devices with some additional info. If no devices

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0or labels are passed,=

btrfs scans all the block devices.

This becomes:

btrfs pool show [<dev>|<label>...]

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 balance|-b <path>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Balance the chunk of =

the filesystem identified by <path> =C2=A0across

Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the devices.

Is path to one of the block devices in the pool?

This becomes:

btrfs pool balance <path>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 add-dev|-A =C2=A0<dev> [<dev>..] <path> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Add 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>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 rm-dev|-R =C2=A0<dev> [<dev>..] <path> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Remove device(s) to t=

he 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi,
I agree with Mike, it's just much much more pleasant and intuitive to work with the hierarchyial cli he suggests.

Alex
=20

Quoted 8 lines · Mike Fedyk

I think he need some command hierarchy here.

On Wed, Feb 17, 2010 at 12:02 PM, Goffredo Baroncelli <[email protected]> wrote:
=20

Quoted 3 lines

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source> =

with the

Quoted 1 line
Quoted 1 line

name <name> in the <dest> directory. If <source> is n=

ot a sub=E2=80=90

Quoted 9 lines
Quoted 2 lines

volume, btrfs returns an error.
=20

This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.

=20

Quoted 2 lines

delete|-D <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is not=

a sub=E2=80=90

Quoted 4 lines
Quoted 3 lines

volume, btrfs returns an error.

   =20
Quoted 9 lines

This becomes:

btrfs subvolume delete <subvolume>

This works with snapshots as well.

=20

Quoted 2 lines

subvolume|-c [<dest>/]<name>
Create a subvolume in <dest> (or in the current dir=

ectory if

Quoted 6 lines
Quoted 2 lines

<dest> is not passed).
=20

btrfs subvolume create [<dest>/]<name>

=20

Quoted 10 lines
Quoted 3 lines

defrag|-f <file>|<dir> [<file>|<dir>...]
Defragment files and/or directories.
=20

This will defrag individual files? Does it defrag a directory tree? Does it defrag a subvolume? Does it defrag a pool?

=20

Quoted 2 lines

scan|-n [<device> [<device>..]]
Scan devices for a btrfs filesystem. If no devices are=

passed,

Quoted 9 lines
Quoted 2 lines

btrfs scans all the block devices.
=20

btrfs pool scan [<device> [<device>..]]

=20

Quoted 3 lines

fssync|-y <path>
Force a sync for the filesystem identified by <path>.

Quoted 10 lines
Quoted 1 line
   =20

Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be:

btrfs subvolume sync <path>

=20

Quoted 2 lines

resize|-z [+/-]<size>[gkm]|max <filesystem>
Resize a file system identified by <path>. The <size> =

parameter

Quoted 1 line
Quoted 1 line

specifies the new size of the filesystem. If the prefi=

x + or -

Quoted 1 line
Quoted 1 line

is present the size is increased or decreased by the=

quantity

Quoted 1 line
Quoted 1 line

<size>. If no units are specified, the unit of th=

e <size>

Quoted 1 line
Quoted 1 line

parameter is the byte. Optionally, the size paramet=

er may be

Quoted 1 line
Quoted 1 line

suffixed by one of the following the units designato=

rs: 'K',

Quoted 1 line
Quoted 1 line

'M', or 'G', kilobytes, megabytes, or gigabytes, respec=

tively.

Quoted 2 lines
Quoted 2 lines

If 'max' is passed, the filesystem will occupy all =

available

Quoted 3 lines
Quoted 3 lines

space on the volume(s).

The resize command does not manipulate the size of u=

nderlying

Quoted 1 line
Quoted 1 line

partitions. If you wish to enlarge/reduce a filesy=

stem, you

Quoted 1 line
Quoted 1 line

must make sure you can expand/reduce the size of the =

partition

Quoted 6 lines
Quoted 3 lines

also.

   =20

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 ma=

x

Quoted 5 lines

without arguments, in order to do that, the size argument would need to be the last argument.

It becomes:

Quoted 9 lines

btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem>

Or:

btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]

=20

Quoted 2 lines

show|-l [<dev>|<label>...]
Show the btrfs devices with some additional info. If n=

o devices

Quoted 1 line
Quoted 1 line

or labels are passed, btrfs scans all the block devices=

=2E

Quoted 24 lines
Quoted 1 line
   =20

This becomes:

btrfs pool show [<dev>|<label>...]

=20

Quoted 2 lines

balance|-b <path>
Balance the chunk of the filesystem identified by <path=

across

Quoted 2 lines

the devices.
=20

Is path to one of the block devices in the pool?

This becomes:

btrfs pool balance <path>

=20

Quoted 3 lines

add-dev|-A <dev> [<dev>..] <path>
Add device(s) to the filesystem identified by <path>.
=20

Quoted 10 lines

What is path? Somewhere the pool is mounted? The root of where the pool is mounted?

this becomes:

btrfs pvolume add <dev> [<dev>..] <path>

=20

Quoted 2 lines

rm-dev|-R <dev> [<dev>..] <path>
Remove device(s) to the filesystem identified by <path>=

=2E

Quoted 11 lines
Quoted 1 line
   =20

(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

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
=20

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Mike Fedyk

I do like the subcommand method, more details below.

Quoted 7 lines · Mike Fedyk

I think he need some command hierarchy here.
=20

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
=C2=A0 =C2=A0 =C2=A0 snapshot|-s <source> [<dest>/]<name> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create a writeble s=

napshot of the subvolume =C2=A0<source> =C2=A0with =C2=A0the

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0name =C2=A0<name> =C2=

=A0in the <dest> directory. If <source> is not a sub=E2=80=90

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs retur=

ns an error.

Quoted 3 lines

=20
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.

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 delete|-D <subvolume>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Delete the subvolum=

e <subvolume>. If <subvolume> is not =C2=A0a =C2=A0sub=E2=80=90

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs retur=

ns an error.

Quoted 5 lines
Quoted 1 line

=20
This becomes:
=20
btrfs subvolume delete <subvolume>

subvol del (same as above).

Quoted 6 lines

=20
This works with snapshots as well.
=20

Quoted 3 lines

=C2=A0 =C2=A0 =C2=A0 subvolume|-c [<dest>/]<name>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create =C2=A0a =C2=A0=

subvolume =C2=A0in =C2=A0<dest> (or in the current directory if

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<dest> is not passe=

d).

Quoted 7 lines

=20
btrfs subvolume create [<dest>/]<name>
=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 defrag|-f <file>|<dir> [<file>|<dir>...] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Defragment files an=

d/or directories.

Quoted 3 lines

=20
This will defrag individual files? Does it defrag a directory tree? Does it defrag a subvolume? Does it defrag a pool?

=46or now lets change this to only do files. That's the only thing the tool supports today.

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 scan|-n [<device> [<device>..]] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Scan devices for a =

btrfs filesystem. If no devices =C2=A0are =C2=A0passed,

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0btrfs scans all the=

block devices.

Quoted 2 lines

=20
btrfs pool scan [<device> [<device>..]]

Instead of btrfs pool, please use btrfs dev

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 fssync|-y <path>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Force a sync for th=

e filesystem identified by <path>.

Quoted 11 lines
Quoted 1 line

=20
Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be:
=20
btrfs subvolume sync <path>
=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 resize|-z [+/-]<size>[gkm]|max <filesystem> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Resize a file syste=

m identified by <path>. =C2=A0The <size> parameter

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0specifies the new s=

ize of the filesystem. =C2=A0If the prefix + or =C2=A0-

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is =C2=A0present =C2=

=A0the =C2=A0size is increased or decreased by the quantity

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<size>. =C2=A0If no=

units are =C2=A0specified, =C2=A0the =C2=A0unit =C2=A0of =C2=A0the =C2=
=A0<size>

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parameter =C2=A0is =

=C2=A0the =C2=A0byte. =C2=A0Optionally, the size parameter may be

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suffixed by one of =

the following =C2=A0the =C2=A0units =C2=A0designators: =C2=A0'K',

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'M', or 'G', kiloby=

tes, megabytes, or gigabytes, respectively.

Quoted 2 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0If =C2=A0'max' =C2=A0=

is =C2=A0passed, =C2=A0the filesystem will occupy all available

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0space on the volume=

(s).

Quoted 2 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The resize command =

does not manipulate the =C2=A0size =C2=A0of =C2=A0underlying

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0partitions. =C2=A0 =

If =C2=A0you =C2=A0wish =C2=A0to enlarge/reduce a filesystem, you

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0must make sure you =

can expand/reduce the size of =C2=A0the =C2=A0partition

Quoted 5 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0also.

=20
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 ma=

x

Quoted 2 lines

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.

Quoted 8 lines

=20
It becomes:
=20
btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> =20
Or:
=20
btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]

btrfs dev resize

Quoted 4 lines

=20

Quoted 3 lines

=C2=A0 =C2=A0 =C2=A0 show|-l [<dev>|<label>...]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Show =C2=A0the btrf=

s devices with some additional info. If no devices

Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0or labels are passe=

d, btrfs scans all the block devices.

Quoted 4 lines

=20
This becomes:
=20
btrfs pool show [<dev>|<label>...]

btrfs dev show

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 balance|-b <path>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Balance the chunk o=

f the filesystem identified by <path> =C2=A0across

Quoted 7 lines
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the devices.

=20
Is path to one of the block devices in the pool?
=20
This becomes:
=20
btrfs pool balance <path>

btrfs dev balance

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 add-dev|-A =C2=A0<dev> [<dev>..] <path> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Add device(s) to th=

e filesystem identified by <path>.

Quoted 3 lines

=20
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.

Quoted 4 lines

=20
this becomes:
=20
btrfs pvolume add <dev> [<dev>..] <path>

btrfs dev add=20

Quoted 5 lines

=20

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 rm-dev|-R =C2=A0<dev> [<dev>..] <path> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Remove device(s) to=

the filesystem identified by <path>.

Quoted 6 lines

=20
(same questions as with add)
=20
This becomes:
=20
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

On Thu, Feb 18, 2010 at 8:58 AM, Chris Mason <[email protected]> w= rote:

Quoted 10 lines

I do like the subcommand method, more details below.

Quoted 7 lines · Mike Fedyk

I think he need some command hierarchy here.

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
=C2=A0 =C2=A0 =C2=A0 snapshot|-s <source> [<dest>/]<name> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create a writeble =

snapshot of the subvolume =C2=A0<source> =C2=A0with =C2=A0the

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0name =C2=A0<name> =

=C2=A0in the <dest> directory. If <source> is not a sub=E2=80=90

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs retu=

rns an error.

Quoted 5 lines
Quoted 3 lines

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. =C2=A0Basically=

the

Quoted 1 line

perl/python arg parsing system where any short form of the command th=

at

Quoted 3 lines

uniquely matches it is allowed.

We keep the long forms but allow the user to pick a shorter form if i=

t

Quoted 2 lines

isn't ambiguous.

Yes, I agree. This is why I compared it with the ip command which does the same.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

=C2=A0 =C2=A0 =C2=A0 delete|-D <subvolume>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Delete the subvolu=

me <subvolume>. If <subvolume> is not =C2=A0a =C2=A0sub=E2=80=90

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0volume, btrfs retu=

rns an error.

Quoted 14 lines
Quoted 5 lines
Quoted 1 line

This becomes:

btrfs subvolume delete <subvolume>

subvol del (same as above).

Quoted 6 lines

This works with snapshots as well.

Quoted 3 lines

=C2=A0 =C2=A0 =C2=A0 subvolume|-c [<dest>/]<name>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create =C2=A0a =C2=

=A0subvolume =C2=A0in =C2=A0<dest> (or in the current directory if

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<dest> is not pass=

ed).

Quoted 7 lines
Quoted 7 lines

btrfs subvolume create [<dest>/]<name>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 defrag|-f <file>|<dir> [<file>|<dir>...] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Defragment files a=

nd/or directories.

Quoted 2 lines
Quoted 2 lines

This will defrag individual files? =C2=A0Does it defrag a directory =

tree?

Quoted 3 lines
Quoted 1 line

Does it defrag a subvolume? =C2=A0Does it defrag a pool?

For now lets change this to only do files. =C2=A0That's the only thin=

g the

Quoted 7 lines

tool supports today.

Quoted 5 lines
Quoted 5 lines

=C2=A0 =C2=A0 =C2=A0 scan|-n [<device> [<device>..]] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Scan devices for a=

btrfs filesystem. If no devices =C2=A0are =C2=A0passed,

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0btrfs scans all th=

e block devices.

Quoted 10 lines
Quoted 2 lines

btrfs pool scan [<device> [<device>..]]

Instead of btrfs pool, please use btrfs dev

Quoted 5 lines
Quoted 5 lines

=C2=A0 =C2=A0 =C2=A0 fssync|-y <path>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Force a sync for t=

he filesystem identified by <path>.

Quoted 11 lines
Quoted 11 lines
Quoted 1 line

Does it sync a pool or subvolume? =C2=A0Assuming it works against subvolumes, it would be:

btrfs subvolume sync <path>

Quoted 4 lines

=C2=A0 =C2=A0 =C2=A0 resize|-z [+/-]<size>[gkm]|max <filesystem> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Resize a file syst=

em identified by <path>. =C2=A0The <size> parameter

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0specifies the new =

size of the filesystem. =C2=A0If the prefix + or =C2=A0-

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is =C2=A0present =C2=

=A0the =C2=A0size is increased or decreased by the quantity

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<size>. =C2=A0If n=

o units are =C2=A0specified, =C2=A0the =C2=A0unit =C2=A0of =C2=A0the =C2= =A0<size>

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parameter =C2=A0is=

=C2=A0the =C2=A0byte. =C2=A0Optionally, the size parameter may be

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0suffixed by one of=

the following =C2=A0the =C2=A0units =C2=A0designators: =C2=A0'K',

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'M', or 'G', kilob=

ytes, megabytes, or gigabytes, respectively.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0If =C2=A0'max' =C2=

=A0is =C2=A0passed, =C2=A0the filesystem will occupy all available

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0space on the volum=

e(s).

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The resize command=

does not manipulate the =C2=A0size =C2=A0of =C2=A0underlying

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0partitions. =C2=A0=

If =C2=A0you =C2=A0wish =C2=A0to enlarge/reduce a filesystem, you

Quoted 1 line
Quoted 1 line
Quoted 1 line

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0must make sure you=

can expand/reduce the size of =C2=A0the =C2=A0partition

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0also.

This works with physical devices, not a pool or subvolume. =C2=A0I g=

et the

Quoted 1 line
Quoted 1 line

name "physical volume" from lvm. =C2=A0Also I think it should resize=

to max

Quoted 4 lines
Quoted 2 lines

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

Quoted 5 lines

I'd like to avoid the pvolume theme.

Quoted 3 lines

It becomes:

Quoted 8 lines
Quoted 5 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

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 'l= ibbtrfs' library and a corresponding API. That way integrating into oth= er languages like Python and integration into tools like parted (or lib= parted) would be quite easy.

Quoted 1 line · Mike Fedyk

On Thu, Feb 18, 2010 at 8:58 AM, Chris Mason <[email protected]>=

Quoted 10 lines · wrote:
Quoted 10 lines

I do like the subcommand method, more details below. =20

Quoted 7 lines · Mike Fedyk

I think he need some command hierarchy here.
=20

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source>=

with the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

name <name> in the <dest> directory. If <source> is=

not a sub=E2=80=90

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

volume, btrfs returns an error.

=20
This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.

=20
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 t=

hat

Quoted 3 lines
Quoted 3 lines

uniquely matches it is allowed.
=20
We keep the long forms but allow the user to pick a shorter form if =

it

Quoted 11 lines
Quoted 2 lines

isn't ambiguous.
=20

=20
Yes, I agree. This is why I compared it with the ip command which does the same.
=20

Quoted 5 lines
Quoted 5 lines

=20

Quoted 4 lines

=20
=20
delete|-D <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is n=

ot a sub=E2=80=90

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

volume, btrfs returns an error.
=20

=20
This becomes:
=20
btrfs subvolume delete <subvolume>

=20
subvol del (same as above).
=20

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

=20
This works with snapshots as well.
=20

Quoted 3 lines

=20
subvolume|-c [<dest>/]<name>
Create a subvolume in <dest> (or in the current d=

irectory if

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

<dest> is not passed).

=20
btrfs subvolume create [<dest>/]<name>
=20

Quoted 4 lines

=20
=20
defrag|-f <file>|<dir> [<file>|<dir>...]
Defragment files and/or directories.

=20
This will defrag individual files? Does it defrag a directory tree=

?

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Does it defrag a subvolume? Does it defrag a pool?

=20
For now lets change this to only do files. That's the only thing th=

e

Quoted 7 lines
Quoted 7 lines

tool supports today.
=20

Quoted 5 lines

=20

Quoted 4 lines

=20
=20
scan|-n [<device> [<device>..]]
Scan devices for a btrfs filesystem. If no devices a=

re passed,

Quoted 18 lines
Quoted 18 lines
Quoted 3 lines
Quoted 1 line

btrfs scans all the block devices.

=20
btrfs pool scan [<device> [<device>..]]

=20
Instead of btrfs pool, please use btrfs dev
=20

Quoted 12 lines

=20

Quoted 5 lines

=20
=20
fssync|-y <path>
Force a sync for the filesystem identified by <path>.
=20

=20
Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be:
=20
btrfs subvolume sync <path>
=20

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

=20
=20
resize|-z [+/-]<size>[gkm]|max <filesystem>
Resize a file system identified by <path>. The <size=

parameter

Quoted 1 line
Quoted 1 line
Quoted 1 line

specifies the new size of the filesystem. If the pre=

fix + or -

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

is present the size is increased or decreased by t=

he quantity

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

<size>. If no units are specified, the unit of =

the <size>

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

parameter is the byte. Optionally, the size param=

eter may be

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

suffixed by one of the following the units designa=

tors: 'K',

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

'M', or 'G', kilobytes, megabytes, or gigabytes, resp=

ectively.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

=20
If 'max' is passed, the filesystem will occupy al=

l available

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

space on the volume(s).
=20
The resize command does not manipulate the size of =

underlying

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

partitions. If you wish to enlarge/reduce a file=

system, you

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

must make sure you can expand/reduce the size of the=

partition

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

also.
=20

=20
This works with physical devices, not a pool or subvolume. I get t=

he

Quoted 1 line
Quoted 1 line
Quoted 1 line

name "physical volume" from lvm. Also I think it should resize to =

max

Quoted 1 line
Quoted 1 line
Quoted 1 line

without arguments, in order to do that, the size argument would nee=

d

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

to be the last argument.

=20
We don't have physical volumes and logical volumes the way lvm does,=

so

Quoted 10 lines
Quoted 10 lines

I'd like to avoid the pvolume theme.
=20

Quoted 8 lines

=20
It becomes:
=20
btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> =20
Or:
=20
btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]

Quoted 5 lines
Quoted 3 lines

=20
btrfs dev resize
=20

=20
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Chris Mason
Quoted 2 lines · Chris Mason

I do like the subcommand method, more details below. =20

I try to summarise your suggestions. But there are some cases not to cl= ear for=20
me.=20
I grouped the commands in three categories: subvolume, devices, and=20 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

=46or the first two categories both Chris and Mike agreed; but IMHO the= re are=20
some commands that don't fit nor in devices, nor subvolume, like resize=
(we=20
resize a filesystem) and label (not available now).

I don't know how classify defrag (per file / directory level ?) and syn= c=20
(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 ?

Quoted 9 lines · Mike Fedyk
Quoted 7 lines

I think he need some command hierarchy here.
=20

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source=

with=20

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

name <name> in the <dest> directory. If <source> i=

s not a=20
sub=E2=80=90

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

volume, btrfs returns an error.

=20
This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.

=20
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 th=

at

Quoted 3 lines

uniquely matches it is allowed.
=20
We keep the long forms but allow the user to pick a shorter form if i=

t

Quoted 7 lines

isn't ambiguous.
=20

Quoted 5 lines

=20

Quoted 4 lines

delete|-D <subvolume>
Delete the subvolume <subvolume>. If <subvolume> is =

not a=20
sub=E2=80=90

Quoted 15 lines
Quoted 6 lines
Quoted 2 lines

volume, btrfs returns an error.

=20
This becomes:
=20
btrfs subvolume delete <subvolume>

=20
subvol del (same as above).
=20

Quoted 6 lines

=20
This works with snapshots as well.
=20

Quoted 3 lines

subvolume|-c [<dest>/]<name>
Create a subvolume in <dest> (or in the current=20

directory if

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

<dest> is not passed).

=20
btrfs subvolume create [<dest>/]<name>
=20

Quoted 4 lines

defrag|-f <file>|<dir> [<file>|<dir>...]
Defragment files and/or directories.

=20
This will defrag individual files? Does it defrag a directory tree=

?

Quoted 10 lines
Quoted 1 line

Does it defrag a subvolume? Does it defrag a pool?

=20
For now lets change this to only do files. That's the only thing the tool supports today.
=20

Quoted 5 lines

=20

Quoted 4 lines

scan|-n [<device> [<device>..]]
Scan devices for a btrfs filesystem. If no devices =

are=20
passed,

Quoted 11 lines
Quoted 3 lines
Quoted 1 line

btrfs scans all the block devices.

=20
btrfs pool scan [<device> [<device>..]]

=20
Instead of btrfs pool, please use btrfs dev
=20

Quoted 5 lines

=20

Quoted 4 lines

fssync|-y <path>
Force a sync for the filesystem identified by <path>=

=2E

Quoted 11 lines
Quoted 11 lines
Quoted 1 line

=20
Does it sync a pool or subvolume? Assuming it works against subvolumes, it would be:
=20
btrfs subvolume sync <path>
=20

Quoted 4 lines

resize|-z [+/-]<size>[gkm]|max <filesystem>
Resize a file system identified by <path>. The <siz=

e>=20
parameter

Quoted 1 line
Quoted 1 line
Quoted 1 line

specifies the new size of the filesystem. If the pr=

efix +=20
or -

Quoted 1 line
Quoted 1 line
Quoted 1 line

is present the size is increased or decreased by =

the=20
quantity

Quoted 1 line
Quoted 1 line
Quoted 1 line

<size>. If no units are specified, the unit of =

the=20
<size>

Quoted 1 line
Quoted 1 line
Quoted 1 line

parameter is the byte. Optionally, the size para=

meter=20
may be

Quoted 1 line
Quoted 1 line
Quoted 1 line

suffixed by one of the following the units design=

ators:=20
'K',

Quoted 1 line
Quoted 1 line
Quoted 1 line

'M', or 'G', kilobytes, megabytes, or gigabytes,=20

respectively.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

If 'max' is passed, the filesystem will occupy a=

ll=20
available

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

space on the volume(s).

The resize command does not manipulate the size of=

=20
underlying

Quoted 1 line
Quoted 1 line
Quoted 1 line

partitions. If you wish to enlarge/reduce a=20

filesystem, you

Quoted 1 line
Quoted 1 line
Quoted 1 line

must make sure you can expand/reduce the size of th=

e=20
partition

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

also.

=20
This works with physical devices, not a pool or subvolume. I get t=

he

Quoted 1 line
Quoted 1 line

name "physical volume" from lvm. Also I think it should resize to =

max

Quoted 1 line
Quoted 1 line

without arguments, in order to do that, the size argument would nee=

d

Quoted 3 lines
Quoted 1 line

to be the last argument.

=20
We don't have physical volumes and logical volumes the way lvm does, =

so

Quoted 10 lines

I'd like to avoid the pvolume theme.
=20

Quoted 8 lines

=20
It becomes:
=20
btrfs pvolume resize [+/-]<size>[gkm]|max <filesystem> =20
Or:
=20
btrfs pvolume resize <filesystem> [[+/-]<size>[gkm]]

Quoted 7 lines

=20
btrfs dev resize
=20

Quoted 4 lines

=20

Quoted 3 lines

show|-l [<dev>|<label>...]
Show the btrfs devices with some additional info. I=

f no=20
devices

Quoted 1 line
Quoted 1 line
Quoted 1 line

or labels are passed, btrfs scans all the block devi=

ces.

Quoted 4 lines
Quoted 4 lines

=20
This becomes:
=20
btrfs pool show [<dev>|<label>...]

Quoted 8 lines

=20
btrfs dev show
=20

Quoted 5 lines

=20

Quoted 4 lines

balance|-b <path>
Balance the chunk of the filesystem identified by <p=

ath>=20
across

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

the devices.

=20
Is path to one of the block devices in the pool?
=20
This becomes:
=20
btrfs pool balance <path>

Quoted 8 lines

=20
btrfs dev balance
=20

Quoted 5 lines

=20

Quoted 4 lines

add-dev|-A <dev> [<dev>..] <path>
Add device(s) to the filesystem identified by <path>=

=2E

Quoted 2 lines
Quoted 2 lines

=20
What is path? Somewhere the pool is mounted? The root of where th=

e

Quoted 3 lines
Quoted 1 line

pool is mounted?

=20
The path just tells us which filesystem to work against. It can real=

ly

Quoted 13 lines

be any path inside the mount point.
=20

Quoted 4 lines

=20
this becomes:
=20
btrfs pvolume add <dev> [<dev>..] <path>

=20
btrfs dev add=20

Quoted 5 lines

=20

Quoted 4 lines

rm-dev|-R <dev> [<dev>..] <path>
Remove device(s) to the filesystem identified by <pa=

th>.

Quoted 6 lines
Quoted 6 lines

=20
(same questions as with add)
=20
This becomes:
=20
btrfs pvolume remove <dev> [<dev>..] <path>

Quoted 7 lines

=20
btrfs dev remove
=20
-chris
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
=20

--=20
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinw= ind.it>
Key fingerprint =3D 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
Quoted 5 lines · Goffredo Baroncelli
Quoted 2 lines · Chris Mason

I do like the subcommand method, more details below.

I try to summarise your suggestions. But there are some cases not to =

clear for

Quoted 19 lines

me.
I grouped the commands in three categories: subvolume, devices, and filesystem.

devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 scan devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 show devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 balance devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 add devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 remove

subvolume =C2=A0 =C2=A0 =C2=A0 snapshot subvolume =C2=A0 =C2=A0 =C2=A0 delete subvolume =C2=A0 =C2=A0 =C2=A0 create [subvolume =C2=A0 =C2=A0 =C2=A0list]

filesystem =C2=A0 =C2=A0 =C2=A0resize [filesystem =C2=A0 =C2=A0 label]

Quoted 6 lines

??? =C2=A0 =C2=A0 defrag
??? =C2=A0 =C2=A0 sync

For the first two categories both Chris and Mike agreed; but IMHO the=

re are

Quoted 1 line

some commands that don't fit nor in devices, nor subvolume, like resi=

ze (we

Quoted 2 lines

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

Quoted 1 line

I don't know how classify defrag (per file / directory level ?) and s=

ync

Quoted 1 line

(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>

Quoted 2 lines

An option is to consider commands without classification. For example=

s:

Quoted 4 lines
$ 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
Quoted 7 lines · Mike Fedyk
Quoted 5 lines · Goffredo Baroncelli
Quoted 2 lines · Chris Mason

I do like the subcommand method, more details below.

I try to summarise your suggestions. But there are some cases not t=

o clear for

Quoted 19 lines
Quoted 19 lines

me.
I grouped the commands in three categories: subvolume, devices, and filesystem.

devices =A0 =A0 =A0 =A0 scan devices =A0 =A0 =A0 =A0 show devices =A0 =A0 =A0 =A0 balance devices =A0 =A0 =A0 =A0 add devices =A0 =A0 =A0 =A0 remove

subvolume =A0 =A0 =A0 snapshot subvolume =A0 =A0 =A0 delete subvolume =A0 =A0 =A0 create [subvolume =A0 =A0 =A0list]

filesystem =A0 =A0 =A0resize [filesystem =A0 =A0 label]

Quoted 6 lines
Quoted 6 lines

??? =A0 =A0 defrag
??? =A0 =A0 sync

For the first two categories both Chris and Mike agreed; but IMHO t=

here are

Quoted 1 line
Quoted 1 line

some commands that don't fit nor in devices, nor subvolume, like re=

size (we

Quoted 5 lines
Quoted 2 lines

resize a filesystem) and label (not available now).

=20
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.

Quoted 7 lines

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".
=20

Quoted 1 line

I don't know how classify defrag (per file / directory level ?) and=

sync

Quoted 9 lines
Quoted 1 line

(filesystem ?)

=20
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:
=20
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.

Quoted 1 line

btrfs defrag pool <pool>

I don't think we'll need defrag pool.

Quoted 3 lines

=20

Quoted 2 lines

An option is to consider commands without classification. For examp=

les:

Quoted 6 lines
Quoted 4 lines
$ btrfs subvolume create [path/]<subvolname>
$ btrfs sync <path>
$ btrfs defrag <file>

=20
Maybe if the btrfs developers are agreeable, we could do this as well=

:

Quoted 3 lines

=20
btrfs sync file <file>
btrfs sync directory <directory>

fsync on files and dirs already does this, we don't need a btrfsctl for it.

Quoted 1 line

btrfs sync subvol <subvol>

btrfs sync subvol is nice.

Quoted 2 lines

btrfs sync pool <pool>
=20

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
Quoted 8 lines · Chris Mason
Quoted 7 lines · Mike Fedyk
Quoted 5 lines · Goffredo Baroncelli
Quoted 2 lines · Chris Mason

I do like the subcommand method, more details below.

I try to summarise your suggestions. But there are some cases not to

clear for

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

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]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

??? defrag
??? sync

For the first two categories both Chris and Mike agreed; but IMHO there

are

Quoted 1 line
Quoted 1 line
Quoted 1 line

some commands that don't fit nor in devices, nor subvolume, like resize

(we

Quoted 22 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 13 lines

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

Quoted 2 lines

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:

Quoted 6 lines
Quoted 3 lines

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>
Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
#12 lore raw
In reply to Chris Mason
Quoted 8 lines · On Thu, Feb 18, 2010 at 12:58 PM, Chris Mason <[email protected]> = wrote:
Quoted 7 lines · Mike Fedyk
Quoted 5 lines · Goffredo Baroncelli
Quoted 2 lines · Chris Mason

I do like the subcommand method, more details below.

I try to summarise your suggestions. But there are some cases not =

to clear for

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

me.
I grouped the commands in three categories: subvolume, devices, an=

d

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

filesystem.

devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 scan devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 show devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 balance devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 add devices =C2=A0 =C2=A0 =C2=A0 =C2=A0 remove

subvolume =C2=A0 =C2=A0 =C2=A0 snapshot subvolume =C2=A0 =C2=A0 =C2=A0 delete subvolume =C2=A0 =C2=A0 =C2=A0 create [subvolume =C2=A0 =C2=A0 =C2=A0list]

filesystem =C2=A0 =C2=A0 =C2=A0resize [filesystem =C2=A0 =C2=A0 label]

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

??? =C2=A0 =C2=A0 defrag
??? =C2=A0 =C2=A0 sync

For the first two categories both Chris and Mike agreed; but IMHO =

there are

Quoted 1 line
Quoted 1 line
Quoted 1 line

some commands that don't fit nor in devices, nor subvolume, like r=

esize (we

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

resize a filesystem) and label (not available now).

A btrfs filesystem can span multiple devices. =C2=A0Resize resizes h=

ow big

Quoted 3 lines
Quoted 1 line

of a chunk of one device btrfs uses.

Right, resize is actually always per device. =C2=A0When there is one =

device

Quoted 4 lines

resizing the FS and the device are the same thing.

Quoted 2 lines

This would be used by
partitioning programs for instance. =C2=A0zfs uses the term "pool" i=

nstead

Quoted 5 lines
Quoted 5 lines

of filesystem to solve this ambiguous use of the term "filesystem" since btrfs and zfs break people's existing definition of the word "filesystem".

Quoted 1 line

I don't know how classify defrag (per file / directory level ?) an=

d sync

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

(filesystem ?)

It turns out that defrag is per file, which seems most cumbersome. Maybe since it will probably eventually work against several types o=

f

Quoted 7 lines
Quoted 5 lines

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/subvo=

l

Quoted 9 lines

side. =C2=A0But we can leave the option open to add these later.

Quoted 1 line

btrfs defrag pool <pool>

I don't think we'll need defrag pool.

Quoted 3 lines
Quoted 3 lines

An option is to consider commands without classification. For exam=

ples:

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
$ btrfs subvolume create [path/]<subvolname>
$ btrfs sync <path>
$ btrfs defrag <file>

Maybe if the btrfs developers are agreeable, we could do this as wel=

l:

Quoted 5 lines
Quoted 3 lines

btrfs sync file <file>
btrfs sync directory <directory>

fsync on files and dirs already does this, we don't need a btrfsctl f=

or

Quoted 2 lines

it.

How do you fsync a file/dir from a shell script? Maybe that's a generic tool that needs to be created...

Quoted 9 lines
Quoted 1 line

btrfs sync subvol <subvol>

btrfs sync subvol is nice.

Quoted 2 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw
In reply to Mike Fedyk
Quoted 4 lines · Mike Fedyk

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

Signature · 2 lines
Tomasz Torcz                 "God, root, what's the difference?"
xmpp: [email protected]         "God is more forgiving."
#14 lore raw
In reply to Chris Mason
Quoted 11 lines · Chris Mason

I do like the subcommand method, more details below. =20

Quoted 7 lines · Mike Fedyk

I think he need some command hierarchy here.
=20

Quoted 3 lines · Goffredo Baroncelli

OPTIONS
snapshot|-s <source> [<dest>/]<name>
Create a writeble snapshot of the subvolume <source=

with=20

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

name <name> in the <dest> directory. If <source> i=

s not a=20
sub=E2=80=90

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

volume, btrfs returns an error.

=20
This should be "btrfs subvolume snapshot <source> [<dest>/]<name>". It only works on subvolumes.

=20
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 th=

at

Quoted 1 line

uniquely matches it is allowed.

So for you

$ btrfs s s <source> <dest>

is OK ?

('btrfs s s' means btrfs subvolume snapshot)

Quoted 1 line

We keep the long forms but allow the user to pick a shorter form if i=

t

Quoted 1 line

isn't ambiguous.

--=20
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwi= nd.it>
Key fingerprint =3D 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html