@@ -22,23 +22,34 @@ 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/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
- 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 +57,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,19 +73,15 @@ 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>."
},
{ do_resize, 2,
- "filesystem resize", "[+/-]<newsize>[gkm]|max <filesystem>\n"
+ "filesystem resize", "[<devid>:][+/-]<newsize>[gkm]|max <filesystem>\n"
"Resize the file system. If 'max' is passed, the filesystem\n"
- "will occupe all available space on the device."
+ "will occupe all available space on the device. <devid> is\n"
+ "the id of the device which grown or will shrink."
},
{ do_show_filesystem, 999,
"filesystem show", "[<uuid>|<label>]\n"
@@ -89,7 +90,7 @@ static struct Command commands[] = {
},
{ 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"
@@ -15,18 +15,20 @@ 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 defrag\fP\fI [-vcf] [-s start] [-l len] [-t size] <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
+\fBbtrfs\fP \fBfilesystem resize\fP\fI [<devid>:][+/\-]<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
.PP
-\fBbtrfs\fP \fBdevice balance\fP\fI <path> \fP
-.PP
\fBbtrfs\fP \fBdevice add\fP\fI <dev> [<dev>..] <path> \fP
.PP
\fBbtrfs\fP \fBdevice delete\fP\fI <dev> [<dev>..] <path> \fP]
@@ -102,8 +104,19 @@ Set the subvolume of the filesystem \fI<path>\fR which is mounted as
is returned by the \fBsubvolume list\fR command.
.TP
-\fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fR
+\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 [-vcf] [-s <start>] [-l <lenght>] [-t <size>] <file>|<dir> [<file>|<dir>...]\fR
Defragment files and/or directories.
+The switch \fB-v\fR turns on the verbose mode.
+The switch \fB-c\fR sets the flag compress on.
+The switch \fB-f\fR turns on the flushing of the data.
+The switch \fB-s\fR sets the beginning of the range to defrag.
+The switch \fB-l\fR sets the length of the range to defrag.
+If the switch \fB-t\fR is passed, any extent bigger than \fB<size>\fR is
+considered already defragged.
.TP
\fBdevice scan\fR \fI[<device> [<device>..]]\fR
@@ -119,7 +132,7 @@ Force a sync for the filesystem identified by \fI<path>\fR.
.\" Some wording are extracted by the resize2fs man page
.\"
-\fBfilesystem resize\fR\fI [+/\-]<size>[gkm]|max <path>\fR
+\fBfilesystem resize\fR\fI [<devid>:][+/\-]<size>[gkm]|max <path>\fR
Resize a filesystem identified by \fI<path>\fR.
The \fI<size>\fR parameter specifies the new size of the filesystem.
If the prefix \fI+\fR or \fI\-\fR is present the size is increased or decreased
@@ -136,6 +149,9 @@ The \fBresize\fR command \fBdoes not\fR manipulate the size of underlying
partition. If you wish to enlarge/reduce a filesystem, you must make sure you
can expand the partition before enlarging the filesystem and shrink the
partition after reducing the size of the filesystem.
+
+<devid> is the ID of the device which was enlarged or which will be reduced.
+To know the ID of a device use the command \fBbtrfs filesystem show\fR.
.TP
\fBfilesystem show\fR [<uuid>|<label>]\fR
@@ -143,7 +159,7 @@ Show the btrfs filesystem with some additional info. If no UUID or label is
passed, \fBbtrfs\fR show info of all the btrfs filesystem.
.TP
-\fBdevice balance\fR \fI<path>\fR
+\fBfilesystem balance\fR \fI<path>\fR
Balance the chunks of the filesystem identified by \fI<path>\fR
across the devices.
.TP
@@ -154,6 +170,12 @@ Add device(s) to the filesystem identified by \fI<path>\fR.
\fBdevice delete\fR\fI <dev> [<dev>..] <path>\fR
Remove device(s) from a filesystem identified by \fI<path>\fR.
+
+If the devices are used in RAID mode, it is not possible to reduce the
+number of the device less than the minimun number (2 devices for RADI1,
+4 devices for RAID10 ...). In this case to replace a failed device, it
+is necessary first add a new one.
+
.PP
.SH EXIT STATUS