Btrfs file System Management and application

Source: Internet
Author: User

Btrfs(usually read asButter FS), byOraclein -years of development followGPLOpen source file system for the contract. Btrfssupport for creating snapshots(snapshot)and recursive snapshots (that is, snapshots that support snapshots), built-in disk arrays (RAIDSupport , supporting the sub-volume, support the write-time replication update mechanism, i.e.Cowmechanism to support the validation code mechanism of data and meta-data, and to automatically compress and decompress the transparent compression mechanism. BtrfsThe file system can be used on a single device, such as hard disks, partitions, etc., and can also be applied to the entire system.

Creation of a btrfs file System

Btrfs--help: Get related Help

mkfs.btrfs [option] DEVICE to create a Btrfs file system

-L: Specify the volume label

-D <type>: Indicates how the data is stored , specifying the raid level

-m<procfile>: indicates how metadata is stored

-O <feature>: Specify characteristics

Mkfs.btrfs-o List-all Display all supported features

The following shows how to create a Btrfs file system: First, add three disks with a size of 20G in the virtual machine and create a Btrfs file system on these three disks

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/EF/wKioL1YKUq7zNptFAAIitaSdq3E760.jpg "title=" image 1. PNG "alt=" wkiol1ykuq7znptfaaiitasdq3e760.jpg "/>


Btrfs filesystem show : Displays btrfs file System Properties, with the following common subcommands:

--mounted: Displays the Btrfs file System Properties that are already mounted

--all-devices: Show all btrfs file System Properties

Resize {+|-}{gg| mm| BB} mount point: Increase or decrease the size of the Btrfs file system of the mount point

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F2/wKiom1YKU8uC-rmDAAF6Fr4dVm0447.jpg "title=" Image 3. PNG "alt=" wkiom1yku8uc-rmdaaf6fr4dvm0447.jpg "/>

You can also view it using the Blkid command, as follows:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F0/wKioL1YKU8LyYAjOAAHlUzZR1tM438.jpg "title=" Image 4. PNG "alt=" wkiol1yku8lyyajoaahluzzr1tm438.jpg "/>

SDB and SDC are labeled MyDate, two disks are created as a btrfs system, so they have the same uuid, but they are two sub-volumes under a btrfs system, so the uuid_sub of the sub-volume is different

Mount Btrfs File system: Mount-t btrfs/dev/device mount_point650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M00 /73/f2/wkiol1ykzofb8mquaab34kitxoi711.jpg "style=" Float:none; "title=" Image 5.png "alt=" Wkiol1ykzofb8mquaab34kitxoi711.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F5/wKiom1YKZN3w6z9FAAFOiB9yXvs307.jpg "style=" float: none; "title=" Image 6.png "alt=" Wkiom1ykzn3w6z9faafoib9yxvs307.jpg "/>


The transparent compression mechanism of BTRFS is introduced:

Mount-o Compress={lzo|zlib} mounting device mount point

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F3/wKioL1YKdWSi72OBAAB8Yg8JOxg163.jpg "style=" float: none; "title=" Image 7.png "alt=" Wkiol1ykdwsi72obaab8yg8joxg163.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F6/wKiom1YKdVqTY7OrAAFUVWDP8aI244.jpg "style=" float: none; "title=" Image 8.png "alt=" Wkiom1ykdvqty7oraafuvwdp8ai244.jpg "/>

When a transparent compression mechanism is used, the compression mechanism is automatically enabled when the file is written to the device.

Reduce the capacity of the Btrfs file system:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F3/wKioL1YKeI_yeeZzAAHjQT9yDeU993.jpg "title=" Image 9. PNG "alt=" wkiol1ykei_yeezzaahjqt9ydeu993.jpg "/>

Increase 5G Capacity: Increase the decrease is the logical boundary, the maximum can not exceed its physical boundary, here is 40G, want to be larger than 40G, need to add physical equipment, to continue to expand capacity

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F6/wKiom1YKeWDSKYGiAAHf5tLw9c0987.jpg "title=" image 10. PNG "alt=" wkiom1ykewdskygiaahf5tlw9c0987.jpg "/>

The following shows how to add a physical device:

Btrfs Device

Add Device mount point: Adding a physical device

Delete Device mount point: Remove physical device

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F6/wKiom1YKfF2wwjMEAABgYL3O-x0505.jpg "title=" image 11. PNG "alt=" wkiom1ykff2wwjmeaabgyl3o-x0505.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F3/wKioL1YKfEqA2a0qAAF7U2PzVq8252.jpg "style=" float: none; "title=" Image 12.png "alt=" Wkiol1ykfeqa2a0qaaf7u2pzvq8252.jpg "/>

Remove a physical device

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F6/wKiom1YKfdGBILLWAAGtrJty0tY258.jpg "title=" image 13. PNG "alt=" wkiom1ykfdgbillwaagtrjty0ty258.jpg "/>

Sub-volume

a sub-volume is equivalent to a separate file system that can be mounted and allocated individually and in size. and the sub-volume can facilitate the administrator on the file system to create a different use of sub-file system , and some special configuration , such as the file in some directories focus on saving disk space , so need to open the compression , or configure a different RAID policy, and so on.

Create a sub-volume : Btrfs subvolume Create <name>

List Sub-volumes:btrfs subvolumelist [-p] <path>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F3/wKioL1YKgF7RkH-sAAETuAYy9_c320.jpg "title=" image 14. PNG "alt=" wkiol1ykgf7rkh-saaetuayy9_c320.jpg "/>


Delete a sub-volume:btrfs subvolume Delete <subvolume>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F6/wKiom1YKgfqRHaHoAADEteS0gHg615.jpg "title=" image 15. PNG "alt=" wkiom1ykgfqrhahoaadetes0ghg615.jpg "/>

Mount Sub-volume:mount-t btrfs-osubvol=/path/subvolume/dev/sd*/path

A separate Mount sub-volume can only access the contents of a child volume, and if the parent volume is mounted, the contents of its child volume are also accessible

Snapshot

a snapshot can be interpreted as an image of a file system for a moment, with the greatest benefit being that it can be minimized

Space to back up the entire file system. Snapshots are recognized as sub-volumes in the system. So to

List and delete snapshots can use the same operations as sub-volumes. A snapshot must be in the same volume group as the original volume.

Snapshot creation : Btrfs subvolume Snapshot [-r] <source> [<dest>/]<name>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F3/wKioL1YKhF6i09mYAADTBtyUEzs308.jpg "title=" image 16. PNG "alt=" wkiol1ykhf6i09myaadtbtyuezs308.jpg "/>

Note: Adding -R will create a read-only snapshot

Delete Snapshot:btrfs subvolume Delete <snapshot>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F3/wKioL1YKhR3TnkRWAADONocY0FM349.jpg "title=" image 17. PNG "alt=" wkiol1ykhr3tnkrwaadonocy0fm349.jpg "/>


This article is from the "Linux" blog, so be sure to keep this source http://yong1205.blog.51cto.com/10404369/1699801

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.