Btrfs
Technical Preview, Technical previews
BtrFS (B-tree file system, also known as butter FS or better FS), 2007 by Oracle Open Source, by the IBM, Intel and other manufacturers of strong support, the goal is to replace the current Linux ext3/ 4, become the next generation Linux standard file system.
Features of Btrfs:
1. Extensibility:
1) The EXT Series file system uses block bitmaps to hold each block free or not (each block uses a bit to indicate whether it is idle), and when the capacity expands, the space occupied by the block bitmap increases linearly, just imagine that if the fast bitmap becomes large, then finding the free block takes a lot of time ; btrfs the smallest unit of managed disk space is extent, a extent consists of a contiguous set of blocks, extent is managed by a extent tree, so it takes 10 bits to represent the 10 block of the Ext series, and btrfs requires only one extent to , thus reducing the amount of metadata. For large files, extent shows superior management performance.
2) Ext system Inode is pre-allocated and fixed size, for example, 100G partition, Inode table can only hold 131,072 inode, which means it is impossible to create 131,072 files, at the same time, the inode allocation is too small, easy to cause disk space is not fully utilized, too large , it is easy to waste disk space; Btrfs to solve this problem, using the dynamic allocation of inode, for example, each inode is only one node in the FS tree, the user can arbitrarily insert the new inode, the physical storage location is dynamically allocated, so there is no limit on the number of files.
2. Multi-Physical volume support:
Btrfs can span multiple physical disk devices, dynamically increase/decrease the device to achieve the purpose of expansion/contraction, technical support (RAID0, RAID1, RAID5, RAID10 and other features), as well as online "add", "Remove" and "modify"
3. Copy-on-write update mechanism (CoW):
Copy, update, and replace pointers instead of "in-place" updates; Btrfs data consistency is guaranteed by cow (copy on write) transactions, so-called cow, that is, each time the disk data is written, the current block data is copied to a new block, and then the new block is updated to write, when the new block writes complete, Simply point the original pointer to the old block to the new block.
4. Data and meta-data check code: Checksum
Another feature of Btrfs is the use of checksum to ensure data reliability, assuming that a block of data is read from disk, you can compare its checksum to determine whether the data is complete, other file systems at the file system level is not aware of the data corruption At the same time, because checksum data is stored on the nodes of the checksum tree and is managed separately from the block data, the benefit is to avoid checksum and the data in the same block, It is not known when the upper layer of the filesystem gets a block of the wrong location (because checksum only calculates whether the block data is complete and not which block the data should have, as long as the data inside the block is not corrupted, checksum is always correct)
5. Sub-Volume: Sub_volume
Creating a sub-volume on a file system (or logical volume) does not have a hierarchy limit, and the amount of space for all volumes can be dynamically adjusted. The scenario is that each user can be assigned a separate, isolated volume space to achieve the purpose of permission control and quota management.
6. Snapshots: Snapshots that support snapshots
7. Transparent compression, Stealth compression:
Mkfs.btrfs
Options:
-l|--label <name>: Assigning a volume label to the Btrfs file system that is about to be created
-d|--data <type>: Specifies the type for the data store; the types you can choose are: RAID0, RAID1, RAID5, Raid6, RAID10, or single
-m|--metadata <profile>: Specifies how metadata is stored; the types you can choose are: RAID0, RAID1, RAID5, Raid6, RAID10, single or DUP
-o|--features <feature1>[,<feature2> ...] : Specifies the features of the Btrfs file system, and if you want to see which features, you can use the command: Mkfs.btrfs-o list-all
The transparent compression function can be turned on using the Mount command that supports the Btrfs file system in the following ways:
Mount-o Compress={lzo|zlib} DEVICE mount_point
Btrfs
Btrfs-control a btrfs filesystem
Btrfs <command> [<args>]
Btrfs filesystem Show
View detailed properties of the Btrfs file system;
Btrfs filesystem DF Mount_point
Viewing file system mounts and usage
Example: Btrfs filesystem df/mnt/btrfs/
Modify file system size online:
Btrfs filesystem Resize {+|-}size[kkmmggttppee] Mount_point
Example: Btrfs filesystem resize-15g/mnt/btrfs/
Btrfs FileSystem Resize +5g/mnt/btrfs/
Btrfs FileSystem Resize max/mnt/btrfs/
Adding or removing devices to the Btrfs file system
Btrfs Device
Btrfs device add [options] <device> [<device> ...] <path>
Add a new device to the file system
Btrfs device Delete <device> [<device> ...] <path>
Remove a device from the file system
Balance data:
Btrfs balance start [options] <path>
Turn on data balancing for chunk across devices
-mconvert={radi0|raid1|raid5|radi10|raid6|single|dup}
Changing the data-balanced layout of metadata
Example: Btrfs balance start-mconvert=raid5/mnt/btrfs/
-dconvert={radi0|raid1|raid5|radi10|raid6|single}
Change the way data is balanced and laid out
Example: Btrfs balance start-dconvert=raid6/mnt/btrfs/
Btrfs Balance Pause <path>
Pause Data balancing
Btrfs Balance Cancel <path>
Cancel a data balance that is in progress or has been paused
Btrfs Balance Resume <path>
Recovering interrupted data balance
Btrfs balance Status [-V] <path>
Displays status information for an in-progress or paused data balance
Sub-volume Management:
Btrfs Subvolume Create [-I <qgroupid>] [<dest>/]<name>
Create a sub-volume
Example: Btrfs subvolume create/mnt/btrfs/mysub1/
Btrfs subvolume Delete [options] <subvolume> [<subvolume> ...]
Delete a child volume
Example: Btrfs subvolume delete/mnt/btrfs/mysub1/
Btrfs Subvolume Show <subvol-path>
displaying information for a sub-volume
Example: Btrfs subvolume show/mnt/btrfs/mysub1/
A sub-volume is similar to an operation in an ext file system that mounts another partition to a free subdirectory under the root directory;
Snapshot:
Btrfs Subvolume Snapshot [-r] [-I <qgroupid>] <source> <dest>| [<dest>/]<name>
To create a snapshot volume for a specified sub-volume
Example: Btrfs subvolume snapshot/mnt/btrfs/mysub1//mnt/btrfs/snap_mysub1
Convert Btrfs and EXT series:
Btrfs-convert
Btrfs-convert-convert from EXT2/3/4 filesystem to btrfs or rollback
Btrfs-convert [Options] <device>
Convert the file system from ext to Btrfs:
~]# BTRFS-CONVERT/DEV/SDB1
Note:/DEV/SDB1 partitions should be formatted in advance to the Ext series file system;
Rollback the file system from Btrfs to Ext
~]# Btrfs-convert-r/DEV/SDB1
Disk quotas:
File server: Shared storage space where users can store data at any time
Ftp
Smb
Network disk
Disk quotas are primarily for this type of file server for user disk space usage restrictions.
Set object for disk quotas:
Block devices capable of implementing read and write operations
To have the correct file system
Disk quotas primarily restrict which objects have access behavior
1. User
Limit disk usage for a specified user
Disk space (block) a block limit that represents 1KB of storage space
Inode
2. Group
Limit the sum of disk usage for all members in a specified group
Type of disk quota:
Soft limit: Soft limits
When the user's usage reaches the soft quota limit, the grace period countdown will be initiated, before the grace period expires, the user can use the remaining quota, when the grace period is zero, the user will not be able to use disk space, unless the data is cleaned, below the soft limit, and then can continue to use disk space;
Hard limit: Rigid limits
The real maximum amount of disk space a user can use
In general, soft limit values are lower than hard limits
The default grace period is 7 days
A data file that requires a user record and a group of disk usage and quota amounts
Aquota.user
Aquota.group
If you want the partition or volume to support disk quota settings, separate mount option support is required;
Usrquota Grpquota
1.# mount-o Usrquota Grpquota DEVICE mount_point
2./etc/fstab
#/device Mount_point fstype defaults,usrquota Grpquota 0 0
Quotacheck
Quotacheck-scan a filesystem for disk usage, create, check and repair quota files
Options
-V,--verbose: Displays detailed information about the entire operation process
-u,--user: Create, detect, and repair user quota files
-g,--group: Create, detect, and repair group quota files
-c,--create files: After detection if there is no user profile and or group quota file, the amount of file created according to the user given option
-a,--all: All the quota files that have the corresponding option on the device that contains the quota-related mount options in the/etc/fstab file
Commands for writing quota content:
Edquota
-u,--user: Write user quotas, default features
-g,--group: Writing group quotas
-t,--edit-period: Set the grace period beyond the soft limit, default seven days, can be selected in seconds, minutes, days for time units
Make the quota function effective
Quotaon: Open
Quotaoff: Off
Quotaon/dev/sdd1
To view the usage of quotas
Quota
Repquota (Administrator-specific) usage of the summary file system
Note: Root is not subject to disk restrictions
Linux Beginner's Btrfs file system and disk quotas