Take notes on laruence's private kitchen (the third edition of Basic)

Source: Internet
Author: User

The most traditional Disk File System (filesystem) in Linux uses EXT2. centos5 supports EXT3 and 6 supports EXT4. The file system consists of the following three parts: 1: superblock: record the overall information of this filesystem, including the total amount of inode/block, usage, remaining amount, and file system format and related information; 2: inode: records the attributes of an archive. An archive occupies one inode and records the block number of the archive data. 3: block: Actually records the archive content, if the file size is too large, multiple blocks are occupied. The number of inode and block is large and cannot be easily managed. Therefore, the Ext2 file system is basically divided into multiple block groups during formatting. Each block group has an independent inode/block/superblock system. Dumpe2fs [-bh] Device File Name: Query Information related to superblock for each block. Df: list the total disk usage of the file system.-h: GBytes, MBytes, KBytes, and other formats are displayed.-I: displays the disk capacity instead of the inode quantity. Du: Evaluate the disk usage of the file system (usually used to estimate the directory capacity ). -S: list the total capacity, rather than the usage of each directory. Ln: Hard connection and symbolic connection. If the parameter is not a hard connection, the parameter-s is used as the symbolic connection, that is, the shortcut. When adding a hard disk to the system, you must perform the following operations: 1. Split the disk to create available partitions; 2. format the partition ), to build the filesystem available for the system; 3. If you want to be careful, you can check the filesystem you just created; 4. On the Linux system, you need to create a mount point (that is, a directory) and mount it. Fdisk-l lists the system disks. Fdisk disk directory (main directory, without symbols) for disk operations, n New, d deleted, p displayed on the screen disk partition, q does not store left, w writes the previous action to the split table. Finally, execute partprobe <= to force the core to catch the partition table again. Mkfs-t vfat/dev/hdc6: format/dev/hdc6 to a windows-readable vfat format. Mke2fs is also formatted with many parameters. Fsck-C-f-t ext3/dev/hdc6, -l show all mounting file Example 3: mount the original Linux CentOS disc! [Root @ www ~] # Mkdir/media/cdrom [root @ www ~] # Mount-t iso9660/dev/cdrom/media/cdrom [root @ www ~] # Mount/dev/cdrom/media/cdrom Example 6: mount/again, and add the rw Parameter not auto [root @ www ~] # Mount-o remount, rw, auto/[root @ www ~] # Umount [-fn] Device File Name ring mount point select attachment not parameter:-f: Force unload! It can be used in a file system similar to network attached storage (NFS). It cannot be read from the hosts file system to the hosts file system.-n: Do not update/etc/mtab. In fact, the/etc/fstab (filesystem table) is to write all the optional parameters of the volume to this file when we use mount mounts to mount the volume row. In addition,/etc/fstab also adds the dump slave to enable the slave to support the slave! Check whether the fsck and other commands are related when you do not start the system. Common compression extensions :*. the Z compress program compresses the swap file ;*. gz gzip program compresses the ghost file ;*. bz2 bzip2 program compresses the ghost file ;*. the tar program has not compressed the volume data. The * .tar.gz tar program has packaged the volume file, which is compressed by the gzip Program * .tar.bz2 tar program, in this example, the file is compressed by bzip2 bytes. copy config to/tmp and compress it [root @ www ~] # Cd/tmp [root @ www tmp] # cp/etc/man. config. [root @ www tmp] # compress-v man. config man. config: -- replaced with man. config. Z Compression: 41.86% [root @ www tmp] # ls-l/etc/man. config/tmp/man * Example 2: uncompress the file that has just been compressed [root @ www tmp] # uncompress man. config. Z [root @ www tmp] # ll man * Example 3: set man. compress config to another archive [root @ www tmp] # compress-c man. config> man. config. back. Z [root @ www tmp] # ll man * gzip: used for compression,-v for compression Decompress,-d to decompress. View the compressed gzip file in zcat. Bzip2 and bzcat are also compression commands, with the gzip and zcat parameter types. In fact, tar is the easiest way to package a file. You only need to remember the following method: compression: tar-jcv-f filename.tar.bz2 to be compressed: tar-jtv-f filename.tar.bz2 unzip: tar-jxv-f filename.tar.bz2-C to decompress the unzip directory #2. test the capacity required to back up the file system? [Root @ www ~] # Dump-S/dev/hdc1 5630976 <= Note that the unit is bytes, so it is about 5.6 MBytes. #0. Check if any file system has been dumped by dump? [Root @ www ~] # Dump-W #1. First, create a 10 MB swap file in/boot: [root @ www ~] # Dd if =/dev/zero of =/boot/testing. img bs = 1 M count = 10 #2. start to create a differential backup file. Here we use level 1: [root @ www ~] # Dump-1u-f/root/boot. dump.1/boot #3. At last, let's take a look at whether level 1 Backup recovery time is recorded? [Root @ www ~] # Dump-W # Let's back up the entire/etc directory through the dump folder and use the ton compression function [root @ www ~] # Dump-0j-f/root/etc.dump.bz2/etc use restore to observe the data content backed up after dump [root @ www ~] # Restore-t-f/root/boot. dump #0. First try to change the file system kernel content: [root @ www ~] # Cd/boot [root @ www boot] # mv config-2.6.18-128.el5 config-2.6.18-128.el5-back #1. See to make the parallel line file system does not back up files between the parallel differences! [Root @ www boot] # restore-C-f/root/boot. dump #2. Change the file system back to ghost! [Root @ www boot] # mv config-2.6.18-128.el5-back config-2.6.18-128.el5 [root @ www boot] # cd/root dd command: Example 1: Back up/etc/passwd to/tmp/passwd. [root @ www ~] in back # Dd if =/etc/passwd of =/tmp/passwd. back Example 2: back up the first sector of your ephemeral disk and then [root @ www ~] # Dd if =/dev/hdc of =/tmp/mbr. back bs = 512 count = 1 0 the beginning of a line, $ the end of a line, the beginning of a gg file, and the end of a G file. H the file header, M file center, T file tail Ctrl + f next page, Ctrl + B Previous Page, 50 GB to 50th rows d Delete single character yy copy row p, P paste I, I, o, O, r, R enter edit mode command mode: w keep q quit! Forced meaning sp Multi-Window Interface

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.