Btrfs file System Management and application

Source: Internet
Author: User

Btrfs: can be called (B-treefs,butter fs,better FS), support cow mechanism, temporarily available on CentOS 7;

Cow:copy on Write, write-time copy mechanism;


Core Features:

Multi-physical volume support; a btrfs can be made up of multiple underlying physical volumes, which can support the raid mechanism by default, Support Online "add", "Remove", "modify";

Copy-on-write update mechanism: Copy, update, and replace pointers instead of "in-place" updates;

When the file is modified, the first copy of the file, in the copied file on the modification, after the modification, the pointer to the original file to the modification of the file to the completion of the modified files, if the modification of the completed file error, we can be repaired by the original file. It is useful in some cases.

Data and meta-data check code: checksum, store each file, the metadata of the check code and data verification code, through some of the file's extended properties to save, when reading the file, can detect whether the file is damaged, once the file is damaged, will automatically attempt to repair the file.

Sub-volume Functions: Sub volume, creating multiple sub-volumes on one volume, creating a filesystem on each volume, and mounting the use;

Snapshot: Snapshot is supported, so a mechanism similar to incremental snapshots can be implemented;

Transparent compression: If we store files, compressed storage, then in the file sent to Btrfs, will automatically occupy the clock cycle, complete the compression of data storage, and the user does not know that when the user reads the file, the file will be automatically decompressed, you can achieve savings in disk space. But compression and decompression will occupy the clock cycle;


Mkfs.btrfs command:

Mkfs.btrfs [OPTIONS]

Common options:

-l|--label <name>: Specifies the volume label of the file system;

-m|--metadata <profile>: Indicates how metadata is stored, can span multiple physical volumes, and supports RAID mechanisms;

-d|--data <type>: Specify the way data is stored and support the raid mechanism;

-o|--features <feature1>[,<feature2> ...] : In the format of the file system, whether to directly open some features of the file system, but in some older versions of the kernel may not support all features;

-O List-all: Lists all supported features;


Recommendation: When you organize a Btrfs file system, use multiple disks directly.

To view Btrfs file System Properties:

First: View the Btrfs file system that is already mounted

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/96/wKiom1YBZgegWug9AAA635YhM6E063.jpg "title=" 1.png " alt= "Wkiom1ybzgegwug9aaa635yhm6e063.jpg"/>

The second type: View all Btrfs file system disks

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/96/wKiom1YBZprB4zk2AAA-V84DYLo568.jpg "title=" 2.png " alt= "Wkiom1ybzprb4zk2aaa-v84dylo568.jpg"/>

Third Type: View the specified Btrfs file system disk


To create a Btrfs file system:

First step: Add two disks to the virtual machine.

Step two: Create a Btrfs file system on the newly added two disk, and specify the volume labeled MyData.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/96/wKiom1YBZuex4mFLAAFyLQrdR7Q815.jpg "title=" 3.png " Width= "620" height= "167" border= "0" hspace= "0" vspace= "0" style= "WIDTH:620PX;HEIGHT:167PX;" alt= " Wkiom1ybzuex4mflaafylqrdr7q815.jpg "/>

Step three: View the already established Btrfs file system.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/96/wKiom1YBZyqhvamaAAEOzG3v2rM038.jpg "title=" 4.png " alt= "Wkiom1ybzyqhvamaaaeozg3v2rm038.jpg"/>

Two disks have the same UUID, but the uuid_sub is different, so the Btrfs file system supports the sub-volume feature.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/93/wKioL1YBZ1XTKvHqAAF4J-i2uxI648.jpg "title=" 5.png " Width= "620" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:620px;height:114px; "alt=" Wkiol1ybz1xtkvhqaaf4j-i2uxi648.jpg "/>

Fourth Step: Mount the disk that has the Btrfs file system set up. Two disks specify one as they belong to the volume group.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/93/wKioL1YBZ4rgAu7lAAA7JkejbNg310.jpg "title=" 6.png " alt= "Wkiol1ybz4rgau7laaa7jkejbng310.jpg"/>


Transparent compressor System:

mount-o Compress={lzo|zlib} DEVICE mount_point

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/96/wKiom1YBZ97yYOzQAABDXSbx6fs189.jpg "title=" 7.png " alt= "Wkiom1ybz97yyozqaabdxsbx6fs189.jpg"/>

Enables the mounted disk partition to support a transparent compression mechanism.


Adjusting logical boundaries can be scaled and scaled without unloading directly.

Reduce the logical boundary size of the Btrfs file system:

btrfs filesystem resize [<devid>:]<size>[gkm]|[ <devid>:]max <path>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/93/wKioL1YBaCzw322vAABhaCMFKrc029.jpg "title=" 8.png " alt= "Wkiol1ybaczw322vaabhacmfkrc029.jpg"/>

to view the size of the file system after the modifications have been completed:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/96/wKiom1YBaBTg9LtYAAGgGnAGqUQ192.jpg "title=" 9.png " alt= "Wkiom1ybabtg9ltyaagggnagquq192.jpg"/>


To extend the logical boundary size of the Btrfs file system:

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "border=" 0 "style=" background:url ("/E /u261/lang/zh-cn/images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/96/wKiom1YBaGLC6kvGAABUxTY1knk341.jpg "title=" 10.png "alt = "Wkiom1ybaglc6kvgaabuxty1knk341.jpg"/>

the usage and reduction of btrfs are somewhat similar.


To modify the size of the physical boundary of the Btrfs file system:

Supports online scaling and scaling.

Using Btrfs add/delete/scan <dev> mount_point

To extend the physical boundaries of the Btrfs file system:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/93/wKioL1YBaOTRB85hAAA8wIklIm4140.jpg "title=" 11.png "alt=" Wkiol1ybaotrb85haaa8wiklim4140.jpg "/>

Reduce the physical boundaries of the Btrfs file system:

Of course, when reducing physical boundaries, first ensure that the size after reduction can store the total file size that has been stored.

Implemented using the Btrfs Delete command.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/93/wKioL1YBaRDCrVhjAAA4_qA_L1Q616.jpg "title=" 12.png "alt=" Wkiol1ybardcrvhjaaa4_qa_l1q616.jpg "/>


Use the BALANCE subcommand to set load balancing for the entire file system:

Support for start, pause, Cancel, resume, status of the several subcommands.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/93/wKioL1YBaVCw49zvAABW_Gz6f_c755.jpg "title=" 13 . png "alt=" wkiol1ybavcw49zvaabw_gz6f_c755.jpg "/> 650" this.width=650; "src="/e/u261/themes/default/ima Ges/spacer.gif "border=" 0 "style=" background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center; border:1px solid #ddd; "alt=" Spacer.gif "/>

When setting up load balancing, set the associated RAID level.

Note: The number of disks is not sufficient and the associated RAID level cannot be set.

Btrfs balance start [OPTIONS] <FILTERS> Mount_point

Common options:

-D: Organizational mechanism for changing data

-M: Changing the organizational mechanism of meta-data

-S: Change the organizational mechanism of the file system

Fileters:

Convert: Set the specified RAID organization

Cases:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/96/wKiom1YBaV6Ta_xPAABJYfUHr3o116.jpg "title=" 14.png "Width=" 620 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:620PX;HEIGHT:19PX; "alt=" Wkiom1ybav6ta_ Xpaabjyfuhr3o116.jpg "/>


Btrfs File System Sub-volume features:

To create a sub-volume:

Btrfs Subvolume Create/path

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/93/wKioL1YBajuAhxHmAAA_6aARYBw359.jpg "title=" 15.png "alt=" wkiol1ybajuahxhmaaa_6aarybw359.jpg "/>

Note: If the parent volume is mounted, the child volume is already mounted by default.

To mount only the sub-volumes:

Mount-o subvol=logs/dev/sdb/mydata/

Sub-volume name Device name mount point

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/93/wKioL1YBafzSERPgAABAsgeSjPM158.jpg "title=" 16.png "alt=" Wkiol1ybafzserpgaabasgesjpm158.jpg "/>

To display information about a sub-volume:

Btrfs Subvolume Show Mount_point

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/96/wKiom1YBamXSZHJ5AAAtYGkAv6o893.jpg "title= "17.png" alt= "wkiom1ybamxszhj5aaatygkav6o893.jpg"/> 650) this.width=650; "Src="/e/u261/themes/default/ Images/spacer.gif "border=" 0 "style=" background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat Center; border:1px solid #ddd; "alt=" Spacer.gif "/>

To delete a sub-volume under a directory:

Example: Delete the logs sub-volume under the MyData directory.

Btrfs Subvolume Delete/mydata/logs

To create a snapshot on a sub-volume:

Note: A snapshot of a child volume must be in the same parent volume as the child volume.

Example: Creating a snapshot on a logs sub-volume in the MyData directory

[Email protected] ~]# Btrfs subvolume snapshot/mydata/logs/mydata/logs_snapshot


Convert an EXT Series file system to a Btrfs file system:

First step: First uninstall the file system of the Ext series to be converted

Step Two: Force file detection using Fsck-f

Step three: Use Btrfs-convert to convert the file system.


Using Btrfs-convert-r, you can also convert a disk that has been converted to Btrfs file system back to the original file system.







This article is from "angry, bird" blog, please make sure to keep this source http://angrybird.blog.51cto.com/10503706/1697267

Btrfs file System Management and application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.