Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of centos7 File system Management btrfs

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you a sample analysis of centos7 file system management btrfs. I hope you will get something after reading this article. Let's discuss it together.

I. introduction to the basics

Btrfs (also known as B-tree, Butter FS, Better FS), GPL license, Oracle developed from 2007, realistic copy update mechanism CoW, which is mainly to replace ext2,ext3,ext4, its main functions are

For example, we are now going to modify a file Arecom cow mechanism is to first copy a copy of the target file An into file B, then when we modify the file, we modify the copy file B, which is equivalent to a snapshot of the source file A. if we modify the file B incorrectly, we can effectively restore the source file A.

Multi-physical volume support: btrfs can be composed of multiple underlying physical volumes, with built-in support for RAID (that is, support for stripe, mirror, etc.) to "add", "remove", and "modify" online

Support b-tree file function, that is, support sub-volume function, such as creating lv in vg

Copy update mechanism when writing (CoW): copy, update, and replace pointers, rather than "in-place" update mechanism

Data and source data check code mechanism checksum: when we store a file, checksum will save the source data and the data check code through the attribute expansion of the file. When we read the data again, we can easily detect whether the data is damaged. If the file is damaged, the system can complete automatic repair.

Support for subvolume sub_volume: you can create subvolumes on one volume, and then mount them separately.

Snapshots: the snapshot feature that supports snapshots is incremental snapshots

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

:

II. File system creation

Command help btrfs-- help

Mkfs.btrfs

-L 'LABEL' specifies the volume label

-d: raid0,raid1, raid5, raid6, raid10, single indicate the data storage type

-m: raid0,raid1, raid5, raid6, raid10, single, dup indicate the mechanism of source data storage

-O indicates the features used in formatting

-O list-all: lists all supported feature

Man btrfs-filesystem to see more subcommands

Mount-t btrfs / dev/sdbMOUNT_POINT mount file system

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

Btrfs filesystem resize ±VALUE MOUNT_POINT resize disk

Btrfs devices [subcommand] args manages disk devices

Btrfs-balance subcomand | args equilibrium data

Btrfs subvolume [subcommand] [args] create subvolumes

Btrfs snapshot creates a snapshot

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

Btrfs subvolume delete snapshot-name deletes child snapshots

Third, create application examples

# fdisk-l View the disks of existing partitions

# mkfs.btrfs-L "mybtrfs" / dev/sdb / dev/sdc creates sdb and sdc disks into a btrfs system

# btrfs filesystem show View the btrfs file system that has been created

# blid / dev/sdb View UUID is the same (indicating that it actually belongs to the same volume)

# mkdir / mybtrfs create mount point

# mount-t btrfs / dev/sda (mount point is / dev/sda is also possible)

# umount / dev/sda Uninstall

# mount-o compress=lzo / dev/sdb / mybtrs is reused, which means automatic compression (transparent compression)

# btrfs filesystem resize-10G / mybtrfs

(btrfs filesystem resize resizes disk)

# btrfs devices add / dev/sdd / mybtrfs automatic disk extension logic boundary

# man btrfs-balance start / mytrfs

# btrfs-lalance start-mconvert=raid1 / mytrfs modifies the raid level of metadata

# btrfs balance status / mytrfs

# btrfs device delete / dev/sda / mybtrfs removes the device and the system moves the data automatically

# btrfs sublimvolume create / mybtrfs to create a subvolume

# btrfs subvolume create / mybtrfs/logs create logs subvolume

Umount / mybtrfs

Mount / dev/sdb / mybtrfs can unmount parent volumes with only child volumes hanging

Btrfs subvolume list / mybtrfs display mybtrs

After reading this article, I believe you have some understanding of "sample Analysis of centos7 File system Management btrfs". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report