@@ -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.</li>
@@ -46,3 +55,5 @@ debug-tree: print all of the FS metadata in text form.
Example:
debug-tree /dev/sda2 >& big_output_file
+
+
@@ -61,6 +61,11 @@ static struct Command commands[] = {
{ do_subvol_list, 1, "subvolume list", "<path>\n"
"List the snapshot/subvolume of a filesystem."
},
+ { do_set_default_subvol, 2,
+ "subvolume set-default", "<id> <path>\n"
+ "Set the subvolume of the filesystem <path> which will be
mounted\n"
+ "as default."
+ },
{ do_find_newer, 2, "subvolume find-new", "<path> <last_gen>\n"
"List the recently modified files in a filesystem."
},
@@ -68,11 +73,6 @@ static struct Command commands[] = {
"filesystem defragment", "[-vcf] [-s start] [-l len] [-t size]
<file>|<dir> [<file>|<dir>...]\n"
"Defragment a file or a directory."
},
- { do_set_default_subvol, 2,
- "subvolume set-default", "<id> <path>\n"
- "Set the subvolume of the filesystem <path> which will be
mounted\n"
- "as default."
- },
{ do_fssync, 1,
"filesystem sync", "<path>\n"
"Force a sync on the filesystem <path>."
@@ -83,29 +83,29 @@ static struct Command commands[] = {
"will occupe all available space on the device."
},
{ do_show_filesystem, 999,
- "filesystem show", "[<uuid>|<label>]\n"
- "Show the info of a btrfs filesystem. If no <uuid> or
<label>\n"
+ "filesystem show", "[<device>|<uuid>|<label>]\n"
+ "Show the info of a btrfs filesystem. If no argument\n"
"is passed, info of all the btrfs filesystem are shown."
},
{ do_df_filesystem, 1,
"filesystem df", "<path>\n"
- "Show space usage information for a mount point\n."
+ "Show space usage information for a mount point."
},
{ do_balance, 1,
"filesystem balance", "<path>\n"
"Balance the chunks across the device."
},
- { do_scan,
- 999, "device scan", "[<device> [<device>..]\n"
+ { do_scan, 999,
+ "device scan", "[<device>...]\n"
"Scan all device for or the passed device for a btrfs\n"
"filesystem."
},
{ do_add_volume, -2,
- "device add", "<dev> [<dev>..] <path>\n"
+ "device add", "<device> [<device>...] <path>\n"
"Add a device to a filesystem."
},
{ do_remove_volume, -2,
- "device delete", "<dev> [<dev>..] <path>\n"
+ "device delete", "<device> [<device>...] <path>\n"
"Remove a device from a filesystem."
},
/* coming soon
@@ -15,21 +15,23 @@ btrfs \- control a btrfs filesystem
.PP
\fBbtrfs\fP \fBsubvolume set-default\fP\fI <id> <path>\fP
.PP
-\fBbtrfs\fP \fBfilesystem defrag\fP\fI <file>|<dir> [<file>|<dir>...]\fP
+\fBbtrfs\fP \fBsubvolume find-new\fP\fI <subvolume> <last_gen>\fP
+.PP
+\fBbtrfs\fP \fBfilesystem balance\fP\fI <path> \fP
+.PP
+\fBbtrfs\fP \fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fP
.PP
\fBbtrfs\fP \fBfilesystem sync\fP\fI <path> \fP
.PP
\fBbtrfs\fP \fBfilesystem resize\fP\fI [+/\-]<size>[gkm]|max <filesystem>\fP
.PP
-\fBbtrfs\fP \fBdevice scan\fP\fI [<device> [<device>..]]\fP
-.PP
-\fBbtrfs\fP \fBdevice show\fP\fI <dev>|<label> [<dev>|<label>...]\fP
+\fBbtrfs\fP \fBdevice scan\fP\fI [<device>...]\fP
.PP
-\fBbtrfs\fP \fBdevice balance\fP\fI <path> \fP
+\fBbtrfs\fP \fBdevice show\fP\fI [<device>|<uuid>|<label>]\fP
.PP
-\fBbtrfs\fP \fBdevice add\fP\fI <dev> [<dev>..] <path> \fP
+\fBbtrfs\fP \fBdevice add\fP\fI <device> [<device>...] <path> \fP
.PP
-\fBbtrfs\fP \fBdevice delete\fP\fI <dev> [<dev>..] <path> \fP]
+\fBbtrfs\fP \fBdevice delete\fP\fI <device> [<device>...] <path> \fP]
.PP
\fBbtrfs\fP \fBhelp|\-\-help|\-h \fP\fI\fP
@@ -47,17 +49,16 @@ For example: it is possible to run
instead of
.I btrfs subvolume snapshot.
But
-.I btrfs dev s
+.I btrfs file s
is not allowed, because
-.I dev s
+.I file s
may be interpreted both as
-.I device show
+.I filesystem show
and as
-.I device scan.
+.I filesystem sync.
In this case
.I btrfs
-returns an error.
-
+returnsfilesystem sync
If a command is terminated by
.I --help
, the relevant help is showed. If the passed command matches more commands,
@@ -102,11 +103,15 @@ Set the subvolume of the filesystem \fI<path>\fR which
is mounted as
is returned by the \fBsubvolume list\fR command.
.TP
+\fBsubvolume find-new\fR\fI <subvolume> <last_gen>\fR
+List the recently modified files in a subvolume, after \fI<last_gen>\fR ID.
+.TP
+
\fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fR
Defragment files and/or directories.
.TP
-\fBdevice scan\fR \fI[<device> [<device>..]]\fR
+\fBdevice scan\fR \fI[<device>...]\fR
Scan devices for a btrfs filesystem. If no devices are passed, \fBbtrfs\fR
scans