• No results found

btrfs filesystem show|sync Utilities

Label: Btrfs uuid: ...

Total devices 2 FS bytes used 9.69MiB

devid 1 size 5.00GiB used 2.03GiB path /dev/sdc devid 2 size 5.00GiB used 2.01GiB path /dev/sdb Use the btrfs filesystem sync command to force a sync for the file system. The file system must be mounted. To force a sync of the file system mounted on /btrfs:

# btrfs filesystem sync /btrfs FSSync ‘/btrfs’

Oracle Linux 7: System Administration 13 - 19

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Use the btrfs filesystem show command to display

the structure of a file system, as in this example:

Use the btrfs filesystem sync command to force a

sync for the file system:

btrfs filesystem show|sync

Utilities

# btrfs filesystem show Label: Btrfs uuid: ...

Total devices 2 FS bytes used 9.69MiB

devid 1 size 5.00GiB used 2.03GiB path /dev/sdc devid 2 size 5.00GiB used 2.01GiB path /dev/sdb

# btrfs filesystem sync /btrfs FSSync ‘/btrfs’

Btrfs provides online defragmentation of a file system, file, or directory. The online

defragmentation facility reorganizes data into contiguous chunks wherever possible to create larger sections of available disk space and to improve read and write performance. Use the btrfs filesystem defragmentcommand to defragment a file or a directory.

btrfs filesystem defragment [options] <file>|<dir> [...]

The available options include the following: • -v– Verbose

• -c– Compress file contents while defragmenting. • -r– Defragment files recursively.

• -f– Flush file system after defragmenting.

-s start– Defragment only from byte start onward.-l len– Defragment only up to len bytes.

-t size– Defragment files only at least size bytes.

You can set up automatic defragmentation by specifying the -o autodefrag option when you mount the file system. Do not defragment with kernels up to version 2.6.37 if you have created snapshots or made snapshots of files by using the cp --reflink option. Btrfs in

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Use the btrfs filesystem defragment command to

defragment a file system, file, or directory.

To defragment a file system:

To defragment and compress a file system:

Set up automatic defragmentation by specifying the

autodefrag

option with the mount command:

btrfs filesystem defragment

Utility

# btrfs filesystem defragment /btrfs

# btrfs filesystem defragment –c /btrfs

# mount –o autodefrag /dev/sdb /btrfs

Btrfs provides online resizing of a file system. Use the btrfs filesystem resize command to resize a file system. You must have space available to accommodate the resizing because the command has no effect on the underlying devices. The syntax is as follows:

btrfs filesystem resize [devid:][+/-]<newsize>[gkm]|[devid:]max <path>

Descriptions of the parameters:

+ newsize– Increases the file system size by newsize amount- newsize– Decreases the file system size by newsize amountnewsize– Specifies the newsize amount

• g, k, or m – Specifies the unit of newsize (GB, KB, or MB). If no units are specified, the parameter defaults to bytes.

• max– Specifies that the file system occupies all available space For example, to reduce the size of the file system by 2 GB:

# btrfs filesystem resize -2G /btrfs Resize ‘/btrfs/’ of ‘-2G’

Oracle Linux 7: System Administration 13 - 21

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Use the btrfs filesystem resize command to

resize a file system.

To accommodate the resizing, you must have space

available on the underlying devices.

To reduce the file system by 2 GB:

To increase the file system by 2 MB:

To have the file system occupy all available space:

btrfs filesystem resize

Utility

# btrfs filesystem resize -2G /btrfs

# btrfs filesystem resize +2M /btrfs

# btrfs filesystem resize max /btrfs

Use the btrfs device command to manage devices on Btrfs file systems. A list of the available commands is as follows:

# btrfs device

Usage: btrfs device <command> [<args>]

btrfs device add [options] <device> [<device>...] <path> Add a device to a filesystem

btrfs device delete <device> [<device>...] <path> Remove a device from a filesystem

btrfs device scan [<--all-devices>|<device>| [<device>...]] Scan devices for a btrfs filesystem

...

The btrfs device scan command scans physical devices looking for members of a Btrfs volume. This command allows a multiple-disk Btrfs file system to be mounted without

specifying all the disks on the mount command.

You do not need to run btrfs device scan from the command line, because udev automatically runs btrfs device scan on boot.

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Use the btrfs device command to manage devices on

Btrfs file systems.

Available commands include:

btrfs device add|delete|scan|ready|stats

The btrfs device scan command scans physical

devices looking for members of a Btrfs volume.

This allows a multiple-disk Btrfs file system to be mounted

without specifying all the disks on the mount command.

Udev

automatically runs btrfs device scan on boot.

The btrfs device ready command checks whether all

devices are in cache for mounting.

The btrfs device stats command shows IO stats.

btrfs device

Utilities

Use the btrfs device add command to add a device to a file system. In this example, the current file system structure is as follows:

# btrfs filesystem show Label: Btrfs uuid: ...

Total devices 1 FS bytes used 4.86MiB

devid 1 size 5.00GB used 276.00MiB path /dev/sdb The btrfs filesystem df command shows:

# btrfs filesystem df /btrfs

Data, single: total=8.00MiB, used=4.74MiB System, single: total=4.00MiB, used=16.00KiB

Metadata, single: total=264.00MiB, used=112.00KiB The output of the df command shows:

# df –h /btrfs

Filesystem Size Used Avail Use% Mounted on /dev/sdb 5.0G 4.9M 4.8G 1% /btrfs

Oracle Linux 7: System Administration 13 - 23

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.

Use the btrfs device add command to add a device

to a mounted file system, as in this example:

Use the btrfs filesystem balance command after

adding a device:

Use the btrfs device delete command to remove a

device from a file system:

Related documents