Learning Log---Linux block group drill down, link, compress and pack

Source: Internet
Author: User

The meaning of block groups


The inode is the location of the data store block for a file, but because of the size of the inode, it is not possible to point to many blocks at once, so a multi-directional, one inode points to a block area, and a block area has many blocks. Then the block under it points to the other area.


The directory file also requires Inode and block, and the contents of the directory file block is a file mapping table indicating the inode of the file in that directory.

The kernel has a root directory, and the kernel knows the inode number of the root partition and the root directory, so start looking for it here.


When the file is deleted, the RM instruction, on the disk, only changes the bitmap information of the Inode and block corresponding to the file, and it is set to 0, indicating that it is unused, so that it can be retrieved if there are no other data insertions in these places.


File movement, if in the same file system, that is, in a partition, the movement of the file is actually the original file corresponding to the inode placed in the new location of the file map. So the movement under the same partition is very fast.

Disk blocks cannot be referenced across partitions (inode points cannot span partitions), and can span different groups in the same region. Therefore, the files in different zones move relatively slowly and need to be duplicated.


Linked files: All provide different access paths for the same file

ln [-S] SRC Linkfile

Hard Links:

Hard links cannot span partitions;

You cannot create a hard link to a directory;

Hard links change the number of times a file is linked;

Hard links point to the same inode as the original file

LS instruction, is to display the file under this directory, the essence is to access the directory block, view the file mapping table, Ls-i can see the directory of the file corresponding to the Inode

Symbolic Links:

The block contains the file path of the link, so it can be cross-partitioned;

The inode of the symbolic link is a string that does not correspond to the data block itself;

Characteristics of Youne;

Symbolic links can span partitions;

The symbolic link file differs from the original file with an inode;

You can create symbolic links to directories;

The symbolic link does not change the number of times the original file was linked;


/lib/libmc.2.so


Ls/lib/libmc.1.so



XYZABC 12


XYZABC XYZABC



Compression tools:

Zip, unzip

Files and directories can be compressed, and directories can be archived for compression.

You need to indicate the file name after compression:

Zip file.zip file


The following three can not be compressed directory, the directory corresponding to the file is a mapping table, there is a corresponding block.

gzip, gunzip = gzip-d, zcat

Suffix:. gz

-C: The compressed result is sent to standard output, you can use redirection to save it as a compressed file, thereby preserving the original file;

[Email protected] ~]# gzip-c anaconda.program.log > anacoda.gz

[[email protected] ~]# ls

2015-10-07-12-40 Anaconda.program.log

Anacoda.gz Install.log.syslog

Anaconda-ks.cfg shell10.sh

gzip-d File Decompression

gzip-9 file Compressed files, 9 refers to the compression ratio

Automatically delete source files after compression or decompression

Zcat can view the contents of a compressed file, but

Gunzip = gzip-d The role of the two


bzip2, bunzip2 = bzip2-d, Bzcat

Suffix:. bz2

Default 6-level compression ratio

-K can keep the original file


XZ (currently compared to hanging), Unxz = xz-d, Xzcat

Suffix:. xz


-#: Specify compression ratio, 1-9


Archive Tool: A packaging tool that packages multiple files into a single

tar [options]-f file.tar File1 ... Be sure to talk to F, and put it at the end.

File.tar is the file name after the specified archive

Can be followed with files or directories

-C: Create an archive

[[email protected] ~]# TAR-CF Pam.d.tar shell4.sh PAM.D (This is the directory, the directory structure will be stored after packaging)

-X: Expand Archive, Restore archive

[Email protected] ~]# TAR-XF Pam.d.tar

-T: Directly view archived files without expanding

TAR-TF Pam.d.tar

will see the normal files and directories, as shown in the structure


-z:gzip can also use compression in tar, the following three corresponding compression formats

-j:bzip2

-j:xz

Package and compress: TAR-JCF pam.d.tar.xz PAM.D

Unpack and unzip: TAR-JXF PAM.D.TAR.XZ


Here are three options for packaging compression:

-zcf

-zxf


-jcf

-jxf


-jcf

-jxf

Files that are compressed after being archived by tar can be uncompressed without specifying what kind of decompression format


Cpio This is also an archive tool


Command summary: hdparm, LN, DD, DF, DU, gzip, gunzip, Zcat, bzip2, bunzip2, Bzcat, zip, unzip, XZ, Unxz, Xzcat, tar


Learning Log---Linux block group drill down, link, compress and pack

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.