Linux Storage Management (3)

Source: Internet
Author: User

Before detailed how to do Disk Management, create a file system for the created disk, the logical address, mainly on the Ext series of file systems, here today to summarize, about the current Linux file system in the rapid development of Btrfs file system, Btrfs Development aims to replace the EXT series file system, the next generation of Linux standard file system, the file system may not be as good as the Ext file system, but its function is very powerful, I believe that in the next 35 years, the application of Btrfs file system will be more and more extensive;

Features of Btrfs file system:

Btrfs is extensible: it can simultaneously extend the logical and physical boundaries of a disk without having to modify it incrementally, and the number of inode can be modified;

Btrfs file system provides multi-physical volume support: it can be used to increase or decrease the capacity of the device to expand or reduce the equipment.

Btrfs file system supports the copy-on-write update mechanism: that is, when the file system writes to the file, the file is copied to a copy, the copy operation, at the completion, the original file inode pointer to the copy, so that the data can be consistent, so as not to lose data;

Btrfs File system support double check mechanism--data and meta-data have check code: checksum

Officer verification code in the specific presence of the tree-shaped area, rather than the metadata area, so that even if the metadata is lost, the verification code will still exist; the checksum of the EXT series file system is stored in the metadata area, so that if the metadata is lost, the data cannot be retrieved;

Btrfs file system supports transparent compression: when the data is stored, the data is automatically compressed, in the appearance of the file is not compressed, but the actual file system has been compressed, when the file is read automatically extracted;

Btrfs file system also supports the function of the snapshot volume and the sub-volume, it can be said that btrfs in the Ext file system based on the enhancement of various function settings;

Create Btrfs:

Mkfs.btrfs

Options:

-l|--label <name: Specify the volume label for the Btrfs file system that is about to be created;

-d|--date <type>: Specify type RAID0 for data store, RAID1, RAID5, Raid6, RAID10 or single

-m|--metadate <profile>: Specifies how metadata is stored, the types you can choose from are: RAID0, RAID1, RAID5, Raid6, RAID10, single, or DUP.

-o|--features <feature1>[<feature2>]: Specifies the characteristics of the file system if you want to see what features you can use the command: Mkfs.btrfs-o list-all

Cases

Set the volume label for the specified file system and set its data storage mode to RAID0

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/96/0F/wKioL1kcUlHj4GN9AAAJmeSZwpM174.png-wh_500x0-wm_ 3-wmp_4-s_364452074.png "title=" Qq20170517213515.png "alt=" Wkiol1kculhj4gn9aaajmeszwpm174.png-wh_50 "/>

To view the details of the file system:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/96/0F/wKiom1kcU0fyfCiAAAAbN2Jc1No824.png-wh_500x0-wm_ 3-wmp_4-s_338519510.png "title=" Qq20170517214220.png "alt=" Wkiom1kcu0fyfciaaaabn2jc1no824.png-wh_50 "/>

To view file system mounts:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/96/0F/wKioL1kcU9CSsDkDAAAckN00Ziw297.png-wh_500x0-wm_ 3-wmp_4-s_562914043.png "title=" Qq20170517214444.png "alt=" Wkiol1kcu9cssdkdaaackn00ziw297.png-wh_50 "/>

To modify the file system size:

Btrfs filesystem Resize {+|-}size{kk|mm|gg| Tt} mount point

Physical Boundary 5g,-1g disk space

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/96/10/wKiom1kcWTuBY9c7AAAi5oa3lGw850.png-wh_500x0-wm_ 3-wmp_4-s_1993376505.png "title=" Qq20170517220745.png "alt=" Wkiom1kcwtuby9c7aaai5oa3lgw850.png-wh_50 "/>

+1G disk space

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/96/10/wKiom1kcXmXQrqyPAAAgLQSenao274.png-wh_500x0-wm_ 3-wmp_4-s_3010413096.png "title=" Qq20170517222947.png "alt=" Wkiom1kcxmxqrqypaaaglqsenao274.png-wh_50 "/>

To extend the physical boundary of disk space:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/96/11/wKiom1kcYEDTs7hYAAAHuOpcRHk458.png-wh_500x0-wm_ 3-wmp_4-s_1331970372.png "title=" Qq20170517223743.png "alt=" Wkiom1kcyedts7hyaaahuopcrhk458.png-wh_50 "/>

To reduce the physical boundary of disk space:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/96/11/wKioL1kcYJTAUBiuAAAH_lwmtO4876.png-wh_500x0-wm_ 3-wmp_4-s_2591420461.png "title=" Qq20170517223905.png "alt=" Wkiol1kcyjtaubiuaaah_lwmto4876.png-wh_50 "/>

Sub-volume Management:

A sub-volume is similar to the operation of an ext system to mount another partition to a free subdirectory under the root directory;

Btrfs Subvolume Create/mount point/Sub-volume name (Create sub-volume)

Btrfs Subvolume Delete/mount point/Sub-volume name (delete sub-volume)

Btrfs Subvolume list-a/mount point/Sub-volume name (Show all sub-volumes)

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/96/11/wKioL1kcYe6ybHBIAAAbfxpfLtI876.png-wh_500x0-wm_ 3-wmp_4-s_1172647334.png "title=" Qq20170517224450.png "alt=" Wkiol1kcye6ybhbiaaabfxpflti876.png-wh_50 "/>


To create a snapshot volume for the specified sub-volume:

Btrfs Subvolume Snapshot/mount point/Sub-volume name (source)/mount point/Snapshot name (Purpose)

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/96/5C/wKiom1kgVdmhXUGiAAAIxmS4Hds599.png-wh_500x0-wm_ 3-wmp_4-s_1374429507.png "title=" Kuaizhao3.png "alt=" Wkiom1kgvdmhxugiaaaixms4hds599.png-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/96/5C/wKiom1kgVe6SopaIAAAWFhyMfCM833.png-wh_500x0-wm_ 3-wmp_4-s_3573621237.png "title=" Kuaizhao1.png "alt=" Wkiom1kgve6sopaiaaawfhymfcm833.png-wh_50 "/>

Disk quotas:

Disk quota is to limit the space of the files that each user can manipulate, and to control the loss of disk capacity;

Disk quota operations, which must be operating under the premise that the disk has created a file system, the main limit is disk space, that is, the number of blocks, and the number of inode, there are two types of disk quotas, one is a soft quota, the user will be alerted when the soft quota limit is reached, will start the grace period countdown But does not restrict user operation, but to the other type of disk quota, hard quota, will restrict the user's operation;

To make a disk quota for a separate partition or volume, you must mount it separately, and the disk quotas are mounted in two ways;

① Direct mount:

Mount-o Usrquota,grpquota Device mount point

② via configuration file/etc/fstab

Device Mount_point fstype defaults,usrquota,grpquata 0 0

The two kinds of disk quotas are mounted in one of the following ways;

Usrquota and Grpquota refer to the quota limit for the user and the quota limit for the group, so that the specified user or group has a quota limit at the mount point to achieve the effective management of resources;

After the disk is mounted, use the command Quotacheck command to detect the quota file and the attached device corresponding to the quota file;

Quotacheck: To detect a file system, disk utilization, repair Disk quota file tools;

-v,--ver: Show more information

-u,--user: Create, Detect and repair user quota files;

-g,--group: Create, Detect and repair quota files;

-c,--create: After detection, if there is no user quota file or group quota file, install the user given option to create the file;

-a,--all: All the devices that contain the quota-related mount option in the/etc/fstab file, and whether there is a quota file for the corresponding option;

Example: Mounting user quotas and group quota information, using the Qutoacheck command to detect the presence of quota files

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/96/5C/wKiom1kgU_aCtcZTAAAJwLrBxXk842.png-wh_500x0-wm_ 3-wmp_4-s_3919342368.png "title=" Qq20170518150959.png "alt=" Wkiom1kgu_actcztaaajwlrbxxk842.png-wh_50 "/>


After the quota file and quota file corresponding to the attached device for detection, you can begin to write quota file content, according to the need to write user quotas, group quotas, to set its memory space soft and hard limit, inode node soft limit and hard limit, you can also set a grace period beyond the soft quota limit;

Edquota

-u,--user: Write user quotas, default function, default unit KB

-g,--group: Write group quotas;

-T: Set the grace period beyond the soft quota limit, the default is 7 days, can be selected in seconds, minutes, hours, days, months, years and other time units;

Example: writing a user quota

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/96/5C/wKioL1kgVJPiJU4jAAAGbu7NBrQ901.png-wh_500x0-wm_ 3-wmp_4-s_2615178082.png "title=" Qq20170518151200.png "alt=" Wkiol1kgvjpiju4jaaagbu7nbrq901.png-wh_50 "/>

Open User Quota Modification interface

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/96/5C/wKiom1kgVMSDkZICAAAO6Pn-_cc552.png-wh_500x0-wm_ 3-wmp_4-s_1560805068.png "title=" Qq20170518151104.png "alt=" Wkiom1kgvmsdkzicaaao6pn-_cc552.png-wh_50 "/>

Open soft quota limit grace period

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/96/5C/wKiom1kgVPuCQXAMAAAPhvOpFpA505.png-wh_500x0-wm_ 3-wmp_4-s_3508233209.png "title=" Qq20170518151129.png "alt=" Wkiom1kgvpucqxamaaaphvopfpa505.png-wh_50 "/>

After the quota has been written, you can start the disk quota function;

Quotaon command

How to use:

Quotaon Equipment

To turn off the disk quotas feature:

Quotaoff command

How to use:

Quotaoff Equipment



















Linux Storage Management (3)

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.