From 6f81e1197015ab2dc41beec92c347919feb26967 Mon Sep 17 00:00:00 2001 From: Goffredo Baroncelli Date: Sun, 5 Dec 2010 17:47:45 +0000 Subject: [PATCH 09/15] Update/clean up btrfs help and man page V2 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: - moved the "subvolume set-default" command in the "subvolume" commands group - removed a wrong new line - small tweak on the basis of Andreas suggestion Regarding the btrfs command man page: - renaming the command "device balance" in "filesystem balance" (thanks to Andreas Phillipp to highlight that) - adding the entry "subvolume find-new" - document the switches of the command "filesystem defrag" - document the facility of the command "filesystem resize" - small tweak on the basis of Andreas suggestion Regarding the INSTALL file, which was very old, I removed the reference of the 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 subvolume/snapshot Chris, you can pull the patch from the branch "help_cleanup" of the following repository. http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git (or you can browse the changes at http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git/?p=btrfs- progs-unstable-all.git;a=summary) The patch is very simple: only updates the man page, the INSTALL file and moves/updates some lines in the help of btrfs command. Comments are welcome. Regards G.Baroncelli Signed-off-by: Chris Mason --- INSTALL | 29 ++++++++++++++++++++--------- btrfs.c | 24 ++++++++++++------------ man/btrfs.8.in | 29 +++++++++++++++++------------ 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/INSTALL b/INSTALL index 16b45a5..3840148 100644 --- a/INSTALL +++ b/INSTALL @@ -22,23 +22,32 @@ in the e2fsprogs sources, and is usually available as libuuid or e2fsprogs-devel from various distros. Building the utilities is just make ; make install. The programs go -into /usr/local/bin. The commands available are: +into /usr/local/bin. The mains commands available are: mkfs.btrfs: create a filesystem -btrfsctl: control program to create snapshots and subvolumes: - +btrfs: control program to create snapshots and subvolumes: + # mount a btrfs filesystem mount /dev/sda2 /mnt - btrfsctl -s new_subvol_name /mnt - btrfsctl -s snapshot_of_default /mnt/default - btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name - 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 + btrfs subvolume snapshot /mnt/snapshot_of_default \ + /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 - Snapshots and subvolumes cannot be deleted right now, but you can - 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 btrfsck: do a limited check of the FS extent trees. @@ -46,3 +55,5 @@ debug-tree: print all of the FS metadata in text form. Example: debug-tree /dev/sda2 >& big_output_file + + diff --git a/btrfs.c b/btrfs.c index 1b4f403..62140ef 100644 --- a/btrfs.c +++ b/btrfs.c @@ -61,6 +61,11 @@ static struct Command commands[] = { { 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,11 +73,6 @@ static struct Command commands[] = { "filesystem defragment", "[-vf] [-c[zlib,lzo]] [-s start] [-l len] [-t size] | [|...]\n" "Defragment a file or a directory." }, - { do_set_default_subvol, 2, - "subvolume set-default", " \n" - "Set the subvolume of the filesystem which will be mounted\n" - "as default." - }, { do_fssync, 1, "filesystem sync", "\n" "Force a sync on the filesystem ." @@ -83,29 +83,29 @@ static struct Command commands[] = { "will occupe all available space on the device." }, { do_show_filesystem, 999, - "filesystem show", "[|