18. when the number of directory connections is hard-connected for file connections, add 1 in the 2nd Field displayed in ls-l. create a directory and set the number of connections to the new directory to 2, the number of connections in the upper directory increases by 119. partition, formatting, checking, and loading partition of the hard disk: fdisk/dev/hdam for help ,...
18. number of directory connections
When "file connection" is performed with a hard connection, 1 is added in the 2nd Field displayed in ls-l. The number of new directories is 2, the number of connections in the upper directory increases by 1.
19. partitioning, formatting, checking, and loading of hard disks
Partition: fdisk/dev/hda
M for help, ldnpqw
Disk Format: mke2fs or mkfs. ext3
# Mke2fs-j-L "logical"/dev/hda1
# Mkfs. ext3/dev/hda1
Disk check: fsck, badblocks
This command is used only when root and the system is faulty. when fsck is executed, the checked partition cannot be loaded to the system. it should be uninstalled.
# Fsck-C-t ext3/dev/hda1
Check whether the hard disk has bad track
# Badblocks-sv/dev/hda1
Disk loading and detaching
Mount-a: mount the related disks according to/etc/fstab.
Mount/dev/hda1/mnt
Mount-t iso9660/dev/cdrom/mnt: load the disc
Mount-t iso9660-o loop/rhel5.iso/mnt
Mount-o remount, rw/
Umount device number or loading point
20. Modify disk parameters
Mknod device name [bcp] [Major] [Minor]
# Mknod/dev/hda1 B 3 10
Major minor value
Hard disk code Major Minor
/Dev/hda 3 0 ~ 63
/Dev/hdb 3 64 ~ 127
/Dev/hdc 22 0 ~ 63
/Dev/hdd 22 64 ~ 127
E2label device name new Label name
Modify the "disk header data", that is, the volume label
# E2label/dev/hda1 hda1
Print the information of the super block and blocks group of the existing file system on a specific device.
# Dumpe2fs-h/dev/hdb1
Extensive tune2fs
Tune2fs [-jlL] device No.
# Tune2fs-l/dev/hda1
21. start loading/etc/fstab and/etc/mtab.
/Etc/fstab is the setting file at startup. the loading records of the actual file system are recorded in the/etc/mtab and/proc/mounts files. Each time the file system is changed to load, both files are changed at the same time. If the data entered in/etc/fstab is incorrect and cannot be started smoothly, when the maintenance mode of a single user is in the read only status, use the following command to change
# Mount-n-o remount, rw/
# Vi/etc/fstab
22. common Linux compression commands
*. Z: files compressed by the compress program
*. Bz2: files compressed by the bzip2 program
*. Gz: files compressed by the gzip program
*. Tar: The data packaged by the tar program has not been compressed.
* .Tar.gz: files packaged by the tar program and compressed by gzip
# Compress-cr/etc
# Compress-d etc. Z
# Compress-cr/etc> etc. Z
# Gzip/etc/man. config login man.configwill be changed to man.config.gz
# Zcat man.config.gz
# Gzip-d man.config.gz decompress the file
# Gzip-9-c man. config> man.config.gz is compressed with the optimal compression ratio and the original file is retained.
# Bzip2-z man. config
# Bzcat man.config.bz2
# Bzip2-d man.config.bz2
# Bzip2-9-c man. config> man.config.bz2 is compressed with the optimal compression ratio and the original file is retained.
# Tar-cvf/tmp/etc.tar/etc package all the files in the/etc directory into/tmp/etc.tar
# Tar-zcvf/tmp/etc.tar.gz/etc compressed with gzip
# Tar-jcvf/tmp/etc.tar.bz2/etc compressed with bzip2
# Tar-ztvf/tmp/etc.tar.gz
# Tar-zxvf/tmp/etc.tar.gz unzip
23. the dd command can not only create a file, but also be used for backup. dd can read the content of the device and then back up the entire device into a file.
# Dd if = "input_file" of = "output_file" bs = "block_size" count = "number"
Cpio command is a method of redirecting data streams to output/input files. it is most suitable for backup.
# Cpio-covB> file | device backup
# Cpio-icduv <file | device restore
Cpio cannot directly read files, but it can be recorded only when the path of each file or directory is the same as the file name. cpio is often used together with the find command.
Author "allenhu0320"