From: Goffredo Baroncelli Subject: Re: [PATCH][btrfs progs] Update/clean up btrfs help and man page Date: Sat, 9 Oct 2010 21:33:25 +0200 Message-ID: <201010092133.32474.kreijack@libero.it> References: <201009132124.09118.kreijack@libero.it> <4CB07234.1080102@gmail.com> Reply-To: kreijack@libero.it Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1784429.iBMi9edJ2Y"; protocol="application/pgp-signature"; micalg=pgp-sha1 Cc: =?iso-8859-1?q?J=E9r=F4me_Poulin?= , Andreas Philipp To: linux-btrfs@vger.kernel.org Return-path: In-Reply-To: List-ID: --nextPart1784429.iBMi9edJ2Y Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all, enclose you can find a patch which improves the help of the btrfs commands, updates the INSTALL file and the btrfs (command) man page. Regarding the help of the btrfs command: =2D moved the "subvolume set-default" command in the "subvolume" commands g= roup =2D removed a wrong new line Regarding the btrfs command man page: =2D renaming the command "device balance" in "filesystem balance" (thanks t= o=20 Andrea Phillipp to highlight that) =2D adding the entry "subvolume find-new" =2D document the switches of the command "filesystem defrag" =2D document the facility of the command "filesystem resize" Regarding the INSTALL file, which was very old, I removed the reference of = the=20 old btrfsctl utility and changed the examples using the btrfs command. I removed the old (and now wrong) statement about the inability to delete a= =20 subvolume/snapshot Chris, you can pull the patch from the branch "help_cleanup" of the followi= ng=20 repository.=20 http://cassiopea.homelinux.net/git/btrfs-progs-unstable-all.git The patch is very simple: only updates the man page, the INSTALL file and moves some lines in the qhelp of btrfs command. Comments are welcome. Regards G.Baroncelli INSTALL | 31 ++++++++++++++++++++++--------- btrfs.c | 17 +++++++++-------- man/btrfs.8.in | 36 +++++++++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 24 deletions(-) diff --git a/INSTALL b/INSTALL index 16b45a5..2c9cf1c 100644 =2D-- a/INSTALL +++ b/INSTALL @@ -22,23 +22,34 @@ in the e2fsprogs sources, and is usually available as l= ibuuid or e2fsprogs-devel from various distros. =20 Building the utilities is just make ; make install. The programs go =2Dinto /usr/local/bin. The commands available are: +into /usr/local/bin. The mains commands available are: =20 mkfs.btrfs: create a filesystem =20 =2Dbtrfsctl: control program to create snapshots and subvolumes: =2D +btrfs: control program to create snapshots and subvolumes: + # mount a btrfs filesystem mount /dev/sda2 /mnt =2D btrfsctl -s new_subvol_name /mnt =2D btrfsctl -s snapshot_of_default /mnt/default =2D btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name =2D btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol + + # create a subvolume + btrfs subvolume create /mnt/new_subvol_name + + # snapshot of a subvolume + btrfs subvolume snapshot /mnt/default /mnt/snapshot_of_default=20 + btrfs subvolume snapshot /mnt/new_subvol_name \ + /mnt/snapshot_of_new_subvol + btrfs subvolume snapshot /mnt/snapshot_of_new_subvol \ + /mnt/snapshot_of_a_snapshot + + # list of the subvolumes ls /mnt default snapshot_of_a_snapshot snapshot_of_new_subvol new_subvol_name snapshot_of_default =20 =2D Snapshots and subvolumes cannot be deleted right now, but you can =2D rm -rf all the files and directories inside them. + # removal of a subvolume or a snapshot + btrfs subvolume delete /mn/snapshot_of_a_snapshot + + # look a the btrfs man page for further information + man btrfs =20 btrfsck: do a limited check of the FS extent trees. =20 @@ -46,3 +57,5 @@ debug-tree: print all of the FS metadata in text form. E= xample: =20 debug-tree /dev/sda2 >& big_output_file =20 + + diff --git a/btrfs.c b/btrfs.c index 46314cf..a607786 100644 =2D-- a/btrfs.c +++ b/btrfs.c @@ -61,6 +61,11 @@ static struct Command commands[] =3D { { do_subvol_list, 1, "subvolume list", "\n" "List the snapshot/subvolume of a filesystem." }, + { do_set_default_subvol, 2, + "subvolume set-default", " \n" + "Set the subvolume of the filesystem which will be mounted\n" + "as default." + }, { do_find_newer, 2, "subvolume find-new", " \n" "List the recently modified files in a filesystem." }, @@ -68,19 +73,15 @@ static struct Command commands[] =3D { "filesystem defragment", "[-vcf] [-s start] [-l len] [-t size] |<= dir> [|...]\n" "Defragment a file or a directory." }, =2D { do_set_default_subvol, 2, =2D "subvolume set-default", " \n" =2D "Set the subvolume of the filesystem which will be mounted\n" =2D "as default." =2D }, { do_fssync, 1, "filesystem sync", "\n" "Force a sync on the filesystem ." }, { do_resize, 2, =2D "filesystem resize", "[+/-][gkm]|max \n" + "filesystem resize", "[:][+/-][gkm]|max \n" "Resize the file system. If 'max' is passed, the filesystem\n" =2D "will occupe all available space on the device." + "will occupe all available space on the device. is\n" + "the id of the device which grown or will shrink." }, { do_show_filesystem, 999, "filesystem show", "[|