Linux 14th Day self-study btrfs and compression archive
Time: 20180731
Btrfs
This file system is designed to address the scalability requirements of large machines for file systems. Find files when directory files become more
The retrieval capability will not grow linearly with data consistency, snapshot backup data, etc.
Characteristics
1. All metadata in this filesystem are managed by the Btree algorithm, with the advantage of finding, inserting, and deleting
Efficient operation.
2. The filesystem uses extent instead of block to manage the disk, extent is a contiguous block, a
The extent is customized by the starting block plus the length.
Extent can effectively reduce metadata overhead, in order to manage disk space, the file system needs to know which blocks
is free. The Ext file system uses each bit in the bitmap to correspond to a block on the disk when the corresponding
After the block is allocated, the corresponding bit in the bitmap is set to 1. It's a classic and very clear design.
Unfortunately, when the capacity of the disk becomes larger, the space occupied by the bitmap itself becomes larger. This leads to a
Scalability issues, as the capacity of the storage device increases, the bit of this metadata occupies more space.
And people hope that no matter how disk capacity increases, the metadata should not increase linearly with it. In Btrfs, the
Only one meta-data is required. For large files, extent shows relatively superior management performance.
3. Dynamic Inode allocation, before file system initialization has already fixed the inode of the system, thus restricting this
The maximum number of files stored by the file system, while in Btrfs users can insert new
Inode, where the physical storage location is dynamically allocated. So Btrfs doesn't have a limit on the number of files.
4. Data consistency features cow transactions, checksum
5. Multi-Device management-related feature snapshots and cloning soft raid
6. Delay allocation
7. Inline file when the data file is too small to be stored in the same extent as the source data
8. Btrfs now has an important drawback when a node in the Btree error occurs, the filesystem loses
All the file information under the node.
Introduction to Btrfs Usage
Creating a file system
Mkfs.btrfs/dev/sda8
Partx-a/DEV/SDA
Mkdir/mnt/btrfs
Mount-t Btrfs/dev/sda8/mnt/btrfs
You can use Df-i to view its inode status, which displays unlimited
As this system is still in development, the author himself also learned not fine, currently only introduced here.
Compression and decompression of Linux system files
Compression Decompression Tool
The Gzip/gunzip command corresponds to a compressed format file that ends in. gz
The BZIP2/BUNZIP2 command corresponds to a compressed format file that ends in. bz2
Xz/unxz it corresponds to the. XZ end of the compressed format file
Zip/unzip it corresponds to a compressed format file at the end of the. zip
Gzip/gunzip
gzip [-ACDFHLLNNRTVV19] [-s suffix] [name ...]
Gunzip [-ACFHLLNNRTVV] [-s suffix] [name ...]
Zcat [-FHLV] [name ...]
-# indicates a compression ratio of 1-9, the default is 6, the higher the number the higher the compression rate
-D Decompress uncompress decompression
-C retains the original data and outputs the compressed data to the standard output
such as Gzip-c/path/files >/path/file.gz
-R recursive recursively to the directory to compress each file
zcat/path/file.gz To view the contents of a compressed file without explicit decompression
Bzip2/bunzip2
bzip2 [-cdfkqstvzvl123456789] [filenames ...]
BUNZIP2 [-FKVSVL] [filenames ...]
Bzcat [-S] [filenames ...]
Bzip2recover filename
-# 1-9 Default to 6 specifies compression ratio
-D decompress equivalent to BUNZIP2
-K to retain the original file after compression
bzcat/path/file.bz2 to view compressed file content without explicit decompression
Xz/unxz
-# indicating compression ratio
-D decompress equivalent to UNXZ
-K Do not delete the original file
Xzcat/path/file.xz To view the contents of a compressed file without explicit decompression
Zip/unzip
Zip File.zip/path/files
Archiving tools
Archiving is the packaging of multiple files into a single file for easy administration, and the default archive does not perform compression
Common tools are tar, Cpio
Tar Archive compression Tool
Archive
Tar-c-f/path/file.tar/path/file
Note: The archive does not delete the original file
Expand Archive
Tar-xf/path/fiole.tar [-c/path/dir]
View a list of archived files
Tar-t-f/path/tarfile.tar
Archive Plus Compress
TAR-ZCF File.tar.gzip/path/files
TAR-ZXF File.tar.gzip
TAR-JCF File.tar.bzip2/path/files
TAR-JXF FILE.TAR.BZIP2
TAR-JCF File.tar.xz/path/files
TAR-JXF FILE.TAR.XZ
Note: You can use TAR-XF file to expand the archive without specifying the compression tool option
Linux 14th Day Self-study btrfs and compression archive