Centos7 file system management btrfs

Source: Internet
Author: User
I. Basic Introduction: Btrfs (also known as B-tree, ButterFS, BetterFS), GPL authorization, Oracle R & D from 2007, realistic replication and update mechanism CoW, mainly to replace ext2, ext3, for example, if we modify File A, the COW mechanism first copies the target file A as file B.

I. Basic Introduction

Btrfs (also known as B-tree, Butter FS, Better FS), GPL authorization, Oracle R & D from 2007, realistic replication and update mechanism CoW, mainly to replace ext2, ext3, ext4, its main functions include:

  • For example, if we want to modify File A, and the COW mechanism is to copy file A to file B first, we will modify the copy file B, it is equivalent to taking A snapshot of source file A. If file B is modified incorrectly, it can effectively restore source file.

  • Multi-physical volume support: btrfs can be composed of multiple underlying physical volumes. it supports RAID (supporting strip, mirror, and other functions) and online "add" and "remove ", "modify" operation

  • The B-tree file function is supported, that is, the sub-volume function is supported, just like creating a lv in vg.

  • Replication and update mechanism during writing (CoW): replication, update, and replace pointer instead of local update mechanism

  • Data and source data verification code mechanism checksum: When we store a file, checksum will save the source data and data verification code through the file property extension, respectively, when we read the data again, we can easily check whether the data is damaged. if the file is damaged, the system can perform automatic repair.

  • Subvolume sub_volume: you can create a subvolume on a volume and then mount and use it separately.

  • Snapshots: Supports the snapshot feature, that is, incremental snapshots.

  • Transparent compression: data is automatically compressed and decompressed to save space and consume a certain amount of cpu

:

II. file system creation

Command help btrfs -- help

 

  1. Mkfs. btrfs

    1. -L 'label' specifies the volume LABEL

    2. -D : Raid0, raid1, raid5, raid6, raid10, single indicates the data storage type

    3. -M : Raid0, raid1, raid5, raid6, raid10, single, dup indicates the source data storage mechanism.

    4. -O Specifying features used during formatting

    5. -O list-all: list all supported feature

  2. Man btrfs-filesystem view more sub-commands

  3. Mount-t btrfs/dev/sdbMOUNT_POINT mount the file system

  4. Mount-o compress = {lzo | zlib} DEVICE MOUNT_POINT transparent compression mechanism

  5. Btrfs filesystem resize ± VALUE MOUNT_POINT resize disk

  6. Btrfs devices [subcommand] args manage disk devices

  7. Btrfs-balance subcomand | args balanced data

  8. Btrfs subvolume [subcommand] [args] create a subvolume

  9. Create a snapshot using btrfs snapshot

    1. The snapshot must be in the same volume group as the original volume, and the snapshot of the child volume must be in the same parent volume as the child volume.

    2. Btrfs subvolume delete snapshot-name delete sub-snapshot

 

3. create an application example

# Fdisk-l view disks with existing partitions

# Mkfs. btrfs-L "mybtrfs"/dev/sdb/dev/sdc create sdb and sdc disks as a btrfs system

# Btrfs filesystem show view the created btrfs file system

# Blid/dev/sdb check that the UUID is the same (meaning it actually belongs to the same volume)

# Mkdir/mybtrfs create a mount point

# Mount-t btrfs/dev/sda (the mount point is/dev/sda)

# Umount/dev/sda uninstall

# Mount-o compress = lzo/dev/sdb/mybtrs re-use, which is automatic compression (transparent compression)

# Btrfs filesystem resize-10G/mybtrfs

(Btrfs filesystem resize to adjust the disk size)

# Btrfs devices add/dev/sdd/mybtrfs automatic disk expansion logic boundary

# Man btrfs-balance start/mytrfs

# Btrfs-lalance start-mconvert = raid1/mytrfs modify the raid level of metadata

# Btrfs balance status/mytrfs

# Btrfs device delete/dev/sda/mybtrfs remove the device, and the system will automatically move the data

# Btrfs sublimvolume create/mybtrfs create a subvolume

# Btrfs subvolume create/mybtrfs/logs create a logs subvolume

Umount/mybtrfs

Mount/dev/sdb/mybtrfs can unmount the parent volume, with only the child volume hanging

Btrfs subvolume list/mybtrfs display mybtrs

Related Article

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.