Linux notes-disk and file systems, compression and archiving

Source: Internet
Author: User

  • Block: The system logically divides the area of the disk into a number of blocks, each of which can be 1024, 2048, 4096 (bytes) device files do not take up disk blocks, and each block has an inode number

  • Super Block super blocks data for block storage:

  • 1. How many block groups are there?

  • 2. How many blocks are included in each block group

  • 3. Size of the Block

  • 4. Free disk block, used disk block, used inode, idle Inode

  • The first block of any partition will be reserved by the system: used by multiple systems to load systems on the boot partition

  • A partition contains: Boot block (the first block of the partition)--block Group0--block group1--block group2 ....

  • Block Group contains: Super Block---GDI (Block Group description table)---data block bitmap (block bitmap)---inode bitmap (inode bitmap)---inode table (inode)-- -Data Block

  • GDI Block Group Description table: Block group name, start block, end block, end block number for each block group

  • Directory Mapping Table:

  • Inode Rec_len Name_len file-type Name

  • 0 21 12 1 2.

  • 12 22 12 2 2..

  • Disk reference format

  • Mode

  • Owner-info

  • Timestamps

  • (primary citation) DIROCT block-----------Data Direct Reference Pointer Limited

  • (Level two reference) INDIROCT block-----------------blocks group-----------{data Data}

  • (Level three reference) DOUBLC INDIROCT--------Block Group-----{block Group block Group}-------{data data Data data} (common to large files, also limited to a single maximum file) indirect reference

  • TRIPLC indiroct

  • File System Management:

  • Re-creating the file system will damage the original file

  • To view the file system types supported by the current kernel: cat/proc/filesystems

  • Mkfs:make File System

  • Mkfs-t fstype/dev/sda#

  • Manage Ext Series Files:

  • Mke2fs-j ext3/dev/sda# directly created as Ext3 file system (Mke2fs-j/dev/sda#)-B: Specifies that the block size default to 4096 bytes can be used with a 1024x768 2048 4096-l: Specify the partition label- M #: Specifies the percentage of blocks reserved to the root user (without the percent sign)-I: Used to specify how many bytes of space to create an inode, the default is 8192 the value given here should be 2 N times the block size N #: Specifies the number of inode to create-f: Forces the creation of the file system ( Partition used for mounting)-E: User specified additional file system properties

  • Blkid: View disk device related properties blkid device name (UUID: Uniform global Unique identifier)

  • Eslabel: Used to view or define a volume label Definition volume Label: E2label Device Name volume label name

  • TUNE2FS: Used to adjust the relevant properties of the file system,-j ext3: Upgrade ext2 to ext3 does not damage the original data, but not degraded (ext2 and ext3 zone ratio: Ext3 added a log file system)-L: Set or modify the volume label-M #: Adjust the reservation percentage-R #: Specify the number of reserved blocks-O: Set default mount Option-C #: Set the number of mounts, after # times to self-test, 0 or 1 To turn off this feature-I #: Do not mount the number of days after the self-test, 0 or 1 To turn off this feature-L: Show information in the Super block

  • DUMPE2FS: Display file property Information-H: Show only Super block information

  • FSCK: Check and Repair file system-T fstype: Specify File System Type-A: automatic repair (do not ask, auto-complete)

  • E2fsck: Specialized check and repair ext2 ext3-f: Force Check-P: Automatic repair can also-u

  • Mount: Associate a new file system to the current root file system

  • Uninstall: Remove the file system from the associated relationship of the current root file system

  • Mount:mount no option to display devices and mount points that are currently mounted on the system, mount [options] [-o options] Device mount_point-a: Represents all file systems defined in the Mount/etc/fstab file-N: Default  The mount command saves the mounted information to the/etc/mtab, using the-N to not write the information to the file, T-fstype: Specifies the type of file system on the device being mounted When you do not use this option, Mount calls the Blkid command to get the corresponding file system type-r: File system, read-only (Mount disc is commonly used)-W: Read-write Mount-o: Refers to the fixed plug-in option

  • Mount Mount device name (device file, volume label, or UUID) mount point (directory)

  • Directory requirements: 1. This directory device is not being used by another process 2. Directory must exist 3. The original file in the directory is temporarily hidden (can be seen after uninstallation)

  • To access files on the corresponding file system by mount point when Mount is complete

  • Umount: Uninstalling a file system Umount device name (device file, volume label, or UUID) or mount point (directory) (mounted device not used by process)

  • Remout: Re-mount the current file system, RO: Read-only mount RW: Read-write mount-o remount,ro/dev/sda#

  • Free: View the swap space information in m for the usage of physical memory and swap space on the current system

  • To create a swap partition:

  • 1. Adjust the partition type: The FDISK command adjusts to the 82 partition type

  • 2.mkswap/dev/sda# (Create swap partition)

  • 3.swapon-a/dev/sda# Open Mount (-A: Enable all switching devices defined in the/etc/fstab file) swapoff/dev/sda# off Mount

  • Loopback devices:

  • Loopback, using software to simulate the implementation of hardware

  • Mount command to mount an ISO image through a loopback device

  • Mount-o Loop ~/centos6.ios/media/(-o loop local loopback device)

  • DD if= source file of= data target bs=1024 (specify size can be in m) count=2 (Specify number)

  • Can be used to back up the MBR:

  • DD IF=/DEV/SDA of=/mnt/usb/bf.backup bs=512 count=1

  • To restore the MBR:

  • DD If=/mnt/usb/bf.backup OF=/DEV/SDA bs=512 count=1

  • Make disc Image: Cat/dev/cdrom > ~/centos6.iso

  • Use files to increase the size of swap space without partitioning:

  • 1.dd/dev/zero of=/var/swfile/bs=1m count=1024 Create a file of 1G size

  • 2.mkswap/var/swfile

  • 3.swapon/var/swfile

  • (DD can also be followed by seek=1023 to indicate that the space after the 1023M has been created is false and can be viewed with du)

  • File system configuration file/etc/fstab: Automatically mounts every file system defined in this file at system startup

  • Device to mount (UUID or device name) mount point file system type Mount option dump screen rate self-test order

  • Mount option: Default is Defaulfs

  • Switching screen rate: Every number of days to do a full backup 1: Every day to do Backup 2: Do a full backup every two days 0: do not back up

  • Self-Test order: Only the root is 1, the other can be 2 0: indicates no check

  • Fuser: Verifying that the process is using a file or socket file-V: Viewing a running process on a file-k-m: Terminating all processes that are accessing this mount point

  • Compression decompression

  • Compression format:. gz. bz2. xz. zip

  • Compression algorithms are different, the compression ratio will be different

  • Gzip bzip2 XZ can only compress files cannot be compressed directory by default source delete files

  • Gzip:gzip file1 file2-d: equivalent to gunzip-#: Specify compression level (1-9), default = 6

  • Decompression: gunzip file1 file2 (source files are also deleted)

  • Zcat file.gz: View the contents of a file without being pressed

  • BZIP2: More compression than gzip, using format with gzip approximation,-K: can keep source files also supports-D-# bunzip: Decompression bzcat: no pressure, view

  • XZ file1 ... : also supports the-D-#-K unxz Xzcat

  • That is, archive and compress:

  • No source files are deleted from the zip unzip

  • Zip-Compressed file name source file

  • Archive: Archiving does not mean compression

  • Tar: Archive tool, do not compress-C: Create archive file-F: Action Archive-x: Restore archive-cf file-xf ... Source files are not deleted by default--xattrs: Archive retains its extended attribute information-TF: View files in Archive XZ compression **.tar file-ZCF: Archive also compress (call gzip compression)-ZXF: Unzip, expand archive-JCF: Call bzip2 compress-JXF: Solution Compression (BZIP2)-JCF: Call XZ compression-JXF: Extract (XZ)-JTF: View--exclude filename: Do not include the filename file when packaging or compressing

  • READ: Interactive-P: Prompt message-t wait time

  • While loop:

  • Suitable for scenes with unknown cycle times, while Cowditiow;do

  • Statement

  • ....

  • Done



This article is from the "stupid Bird first-FAI" blog, please be sure to keep this source http://benniaoxianhui.blog.51cto.com/10463960/1679207

Linux notes-disk and file systems, compression and archiving

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.