Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

5. Partition formatting, compression, mounting, and decompression of learning notes

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

File system:

MBR: Master Boot Record, master boot record (sector 0 exists in 512bytes)

512bytes:

Bootloader: 446bytes

Fat: 64bytes, 16bytes, 4

MBR validity Mark: 5A

Up to 4 primary partitions, 3 primary partitions and 1 extended partition (the extended partition refers to an additional partition table). To use the extended partition, you need to divide the logical partition in the extended partition.

Hard disk interface:

IDE (ATA), SCSI, SATA (6Gbps), SAS (6Gbps)

Fdisk / dev/sda

D: deletin

L: list the partitions supported by the kernel ID

P: list

N: new

Q: do not save exit

T: adjust partition ID

W: save exit

CentOS 5: partprobe

CentOS 6: partx, kpartx

Kpartx-l / dev/sda

Kpartx-af / dev/sda

Partx-a / dev/sda

Create a file system

Mkfs-t fstype / dev/somedevice

Ext4:

Mkfs-t ext4 = mkfs.ext4 = mke2fs-t ext4

Ext3:

Mkfs-t ext3 = mkfs.ext3 = mke2fs-t ext3 = mke2fs-j

Mke2fs:

Configuration file: / etc/mke2fs.conf

-t {ext2 | ext3 | ext4} specify the file system type

-j specifies the file system type as ext3

-L Label specifies the volume label

-b {1024 | 2048 | 4096} specify block size

-I # specify # bytes to reserve an inode

-N # specifies how many Inode are reserved

-I # specify Inode size

-m # percentage of space reserved for administrators. Default is 5.

-O specify partition properties

E2label/dev/SOMEDEVICE View Volume label

E2label / dev/SOMEDEVICE Label set volume label

Blkid / dev/SOMEDEVICE view the properties of the device, UUID and TYPE

Dumpe2fs-h/dev/SOMEDEVICE only views the information saved in the super block

Modify the file system

Tune2fs

-l view the information in the super block

-L label set volume label

-m percentage of space reserved for administrators, default is 5

If the original file system is ext2,-j can promote it to ext3

-o [^] mount-options [,...] Set its default mount options

-O [^] feature [,...] Adjust zoning properti

Fsck:

-t fstype specifies the file system type

-an automatically fix errors

-r Interactive error repair

E2fsck:

-f mandatory detection

-y automatically answer yes to the question

Swap Partition:

Virtual memory

Mkswap-L label specifies the volume label

Swapon

-an enable all swap partitions

-p #: specify priority to specify the priority of the swap partition

Swapoff

-a close all swap partitions

Mount [options] [- t fstype] [- o option] device mount point

Options for the [options] command

-o enable partition feature when options is mounted

Mount is used directly to display all mounted devices in the current system (/ proc/mounts, / etc/mtab)

Common options:

-t specifies the type of file system to mount

-r Mount as read-only

-w mount read and write

-L lable specifies the mount device with volume label, LABLE= "label"

-U UUID: Mount the device as specified by UUID, UUID= "UUID"

-an automatically mount all devices (in / etc/fstab file) that support automatic mount

-o options

Async/sync Asynchronous / synchronous IO

Whether noatime/atime updates the access timestamp of the file. It is recommended that noatime

Whether auto/noauto can be automatically mounted by the mount-an option

Whether diratime/nodiratime updates the access timestamp of the directory

Whether exec/noexec allows the execution of binaries in it

_ netdev enable this option to prevent constant attempts to mount network devices when the network is unavailable

Remount can be remounted without unmounting

Acl enables facl

# tune2fs-o mount-option enable mount option

# tune2fs-o ^ mount-option unmount option

CD: [- t iso9660]

Fuser-v mount point to view the process of occupied mounted devices

Fuser-km mount point shuts down the process of occupying mounted devices

Umount device | Mount point uninstall

Df [options] [device] disk space usage status report

-h displays disk space usage in a readable manner

-I display the usage of disk inode

-P displays the disk space usage in POSIX mode, which is used to prevent items from being displayed in multiple lines when they are too long.

Du [options] [dirName] assesses the disk space occupied by files

-s displays only the total file size

-h is displayed in a readable manner

Boot and mount automatically:

/ etc/rc.d/rc.sysinit: system initialization script

One of the functions: Mount the file system mount table defined in the / etc/fstab file

Device mount point to mount file system type mount option dump frequency self-test order

Device files to be mounted, LABEL=, UUID=

The mount point swap has no mount point, and the mount point is swap

File system Typ

Mount options separated by commas between multiple options

Dump frequency 0 never backup, 1 daily backup

Self-test sequence 0 does not self-test, 1 self-test first, usually can only be / used

View memory space usage status:

# cat / proc/meminfo

# free

-m display results in MB

-g display results in GB

Dd command:

Dd if=input_file of=output_file copies the entire file

Dd if=input_file of=output_file bs=# [b | k | m | g] count=# copies files of the specified size

Making disk image file by dd if=/dev/cdrom of=/tmp/linux.iso

Cat / dev/cdrom > / tmp/linux.iso to make a disk image file

Dd if=/dev/sda of=/tmp/myfile bs=512 count=1 backup MBR

View dd progress

Watch-n 5 killall-USR1 dd

Link file:

Ln [- s] SRC LINKFILE

Hard links:

Hard links cannot cross partitions

Cannot create a hard link to a directory

Hard links change the number of times a file is linked

The hard link points to the same inode as the original file

Symbolic links:

Symbolic links can be across partition

The symbolic link file is different from the original file in an inode

You can create symbolic links to directories

Symbolic links do not change the number of times the original file is linked

Compression tool:

Gzip, bzip2, xz compression and decompression will delete the source file, and the directory cannot be compressed.

Gzip filename compressed file with the suffix .gz

-c sends the compression result to standard output, which can be saved as a compressed file using redirection, thus retaining the original file

-# specify compression ratio, 1-9

-d decompress the file

Gunzipfilename.gz decompresses the file

Zcatfilename.gz does not unzip to view the contents of the compressed file

Bzip2filename compressed file with the suffix .bz2

-k decompression is to save the source file

-# specify compression ratio, 1-9

-d decompress the file

Bunzip2filename.bz2 decompresses the file

Bzcatfilename.bz2 does not unzip to view the contents of the compressed file

Xzfilename compressed file with the suffix .xz

-k decompression is to save the source file

-# specify compression ratio, 1-9

-d decompress the file

Unxzfilename.xz decompresses the file

Unzip xzcatfilename.xz to view the contents of the compressed file

Zip compression and decompression does not delete the source file, and can compress the directory

Zipfilename.zipfilename compressed file or directory

Unzipfilename.zip decompresses the file

Archiving tools:

Tar [options]-f file.tar File1...

-c: create an archive

-x: expand the archive

-t: view the archived file directly without expanding it

-z: gzip

-j: bzip2

-J: xz

-zcf

-zxf

-jcf

-jxf

-Jcf

-Jxf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report