Linux File System Management
File System Management:
Re-create a file system will damage the original file
Mkfs: make file system
Partition specified by mkfs-t TYPE
Mkfs-t ext2 = mkfs. ext2
Mkfs-t ext3 = mkfs. ext3
Mke2fs
-J: Create an ext3 file system.
-B BLOCK_SIZE: Specifies the block size.
-L label: Specify the volume LABEL of the partition.
-M #: Specify the percentage of blocks reserved for the super user to be # %.
-I #: used to create an inode for the specified size of bytes. The default value is 8192. The size given here is 2 ^ n times the block size.
-N #: specifies the number of inode
-F: force file system creation
-E: used to specify additional file system attributes
Blkid: Properties of the user's display/Positioning block Device
UUID:
TYPE:
LABEL:
E2label: Used to view or define the volume label
E2label/dev/sda2 标 --> set the 标
E2label/dev/sda2 --> used to view the volume label
Tune2fs: Adjust file system attributes
-J: Upgrade ext2 to ext3 without damaging the original data.
-L: Used to set or modify the volume label
-M #: Adjust the percentage reserved for Super Users
-R #: specify the number of reserved blocks.
-O: Set the default mounting option.
-C #: specify the number of hangs to be reached # perform self-check after several times, 0 or-1 mark to disable the Function
-I #: specifies the number of days each hanging on for self-check. 0 or-1 indicates that this function is disabled;
-L: displays the information in the superblock.
Dumpe2fs: displays file system attributes
Dumpe2fs-h: only super block information is displayed.
Fsck: Check and fix the Linux File System
-T TYPE: Specifies the file system TYPE.
-A: Automatic Repair
E2fsck: dedicated repair of ext2/ext3 file systems
-P: Automatic repair or (-)
-F: force check
Mount: mount the new file system to the file system
Mount
Mount device mount point
Device:
Device File:/dev/sda3
Volume LABEL: LABEL = ""
UUID: UUID = ""
Mount point: Directory
Requirements:
1. This directory is not used by other processes;
2. The directory must exist beforehand;
3. Files in the directory will be temporarily hidden
Mount [options] [-o options] DEVICE MOUNT_POINT
-A: indicates all file systems mounted to the/etc/fstab file
-N: by default, the mount command saves the information of the mounted device to the/etc/mtab file every time a device is mounted. Using the-n option, do not write information into this file.
-T TYPE: specifies the TYPE of the file system on the mounted device. If this option is not used, mount will call the blkid command to obtain the TYPE of the corresponding file system.
-R: Read-Only mounting. This option is often used to attach a CD.
-W: read/write mounting
-O: specify additional mounting options, that is, specify the File System
Remount: remount the current File System
Ro: Read-Only mounting
Rw: read/write mounting
Loop: mount a local loop device.
After mounting, access the files on the corresponding file system through the mount point.
Unmount: remove the association between a file system and the current root file system.
Umount: unmount the File System
Umount Device
Umount mount point
Precautions for uninstallation:
1. The mounted device is not used by the process.
Swap partition:
Free
-M
In the fdisk command, adjust the partition type to 82.
Create swap partition:
Mkswap/dev/sda5
Swapon/dev/sda5 Mount swap partitions
Swapoff/dev/sda8 unmount the swap Partition
Swapon-a enables all swap partitions in the/etc/fstab file
Loop device:
Loopback, using software to simulate hardware implementation
Create an image file: 120 GB --> format as a swap Partition
Dd if =/etc/inittab of =/root/inittab, simulate the cp command
If =: Input File
Of =: output file
Bs = SIZE: Specifies the SIZE of the copy block.
Count =: Number of copies
Seek = #: size of the Space skipped during data creation
Dd if =/dev/sda of =/mnt/usb/mbr. backup bs = 512 count = 1 // backup mbr
Dd if =/mnt/usb/mbr. backup of =/dev/sda bs = 512 count = 1 // recover mbr
Dd if =/dev/zero of =/dev/swapfile bs = 1 M count = 1024
Mkswap/var/swapfile
Swapon/var/swapfile
File System configuration file/etc/fstab:
During Linux Initialization, each file system under this file is automatically mounted.
Mount Option dump frequency of the file system type of the mount point of the device to be mounted (full backup is performed every few days) File System check sequence (only the root is 1)
/Dev/sda3/mnt/hello ext4 defaults0 0
Fuser: the file or socket file being used by the verification process.
-V FILE: view the running process on a FILE
-K
-M
Fuser-km MOUNT_POINT: Terminate all processes that are accessing this mount point