First, the basic knowledge of the disk
1. Disk classification
Mechanical hard-disk
Solid-state Drives
2. Disk interface type:
IDE: Under Linux file name/dev/hd[a-d], maximum speed up to 133MBytes
SCSI: Under Linux file name/dev/sd[a-z], up to a maximum rate of 640MBytes
SATA: Under Linux file name/dev/sd[a-z], up to a maximum rate of 6Gbps
SAS: Under Linux file name/dev/sd[a-z], maximum speed up to 6Gbps
USB: Under Linux file name/dev/sd[a-z], maximum speed up to 480MBytes
3, the partition of the disk:
Primary partition (primary) and extended partition (exended):/dev/sd[1-4],
Logical Partitioning (logicalpartition): Starting from/dev/sd5,
4. Device Number:
Major: Differentiating device types
Minor: distinguish between different devices of the same device type
Second, disk partitioning tool
1. Fdisk: Support for up to 15 partitions on a single hard drive
Options:
-L: List all disk devices
Sub-command:
P: Show Partition list
N: Create a new partition
D: Delete partition
T: Modify the partition ID
L: List all support ID types
W: Save exit
Q: Exit does not save
M: Get Help
See if the kernel and the new partition are recognized: cat/proc/partitions
Let the kernel reread the disk partition table:
CentOS 5:partprobe [DEVICE]
CentOS 6 and 7:partx–a [DEVICE]
KPARTX–AF [DEVICE]
Third, file System management
1, File system classification:
Linux:ext2,ext3,ext4,reiserfs,xfs,btrfs,swap
Ext2 is not a log file, ext3 is a log file
Disc: ISO9660
Windows:fat32,ntfs
Unix:ffs,ufs,jfs,jfs2
Network File system: Nfs,cifs
Cluster file system: OCFS2,GFS2
Distributed File System: Ceph
2. Create File system
MKFS command: MKFS [-v] [-t fstype] [fs-options] filesys [blocks]
Options:
-T: Specifies the system file type, equivalent to Type=mkfs.type
MKE2FS (ext type only): Mke2fs [OPTION] ... DEVICE
Options:
-T: Specify the System file type
-B: Specify the size of each block (supports 1024,2048,4096)
-I: Specify the number of bytes per Inode
-C: Check for disk errors
-L: Specify the volume label name
-j: equivalent to mke2fs–t ext3
-N: Specifies how many inode the file system has
-M: Specify a percentage of the reserved space
3. File Decency Properties View and adjustment tool:
E2label:e2label device [New-label]
View Volume Label: E2label/dev/device
Set Volume Label: E2label/dev/device "LABEL"
TUNE2FS: Displays the properties of the Ext series file system and adjusts its properties
Options:
-L: Displays information in the Super block
-L: Modify the volume label
-j: equivalent to mke2fs–t ext3
-M: Specify a percentage of the reserved space
-O: File System properties are enabled or closed
-O: File system default mount option enabled or closed
DUMPE2FS:
Dumpe2fs–h/dev/device: Show only Super block information
Super BLOCK: is a place to record information about the entire file system, the main information is:
1. Total Block and Inode
2. Unused and used Inode and block number
3. Size of block and inode
4, the file system mount time, the last time the data was written, the last time to verify the disk
5, valid bit value, mounted as 0, not mounted as 1
4, the File system detection
Fsck:
Options:
-T: Specify the System file type
-A: Automatic detection of problematic fans
-R: Interactive check
-F: Forced check
-D: Optimized configuration for directories under the file system
E2fsck:ext Series file system-specific detection and repair tools
5. File system mount and use
mount:mount [Options] [-o options] DEVICE mount_point
[Options]: Options command
-T: Specifies the type of file to mount
-A: Mount all non-mounted disks according to/ETC/FSTAB data
-L: Specify the volume label name
-r: Mount this file system as "read-only" mode
-W: Mount this file system in read-write mode
-B: Bind directory to another directory
-N: Each file system automatically updates the/etc/mtab file when it is mounted, and-n is used to disallow this function; At this point, if you want to view all file systems mounted Cat/proc/mounts
[-O options]: Mount options
Async: Async Mode
Sync: Synchronous mode
Remount: Re-mount
ACL: whether to support the use of FACL on this device
User/nouser: Whether to allow normal mount of this device
Atime/noatime: Whether more access timestamp
Auto/noauto: Whether this device is allowed to be mounted automatically
Diratime/nodiratime: Whether to update the access timestamp of the directory
Exec/noexec: Whether the application on this file system is allowed to execute
Dev/nodev: Whether to support the use of device files on this device
Defaults: including Rw,suid,dev,exec,auto,nouser,async
Device: Devices to be mounted (can be device files, volume labels, UUID, pseudo file system names)
Mount_point: Mount point
Umount: Uninstalling
Umount DEVICE
Umonut Mount_point
To view the process that is accessing the specified mount point: Fuser–v mount_point
Terminates all processes that are accessing the specified mount point: fuser:-km mount_point
Iv. Swap partitions:
Free: view memory and swap usage status
-M: in megabytes
-G: in gigabytes
Mkswap: Creating Swap partitions
mkswap [option] DEVICE
Swapon: Enable swap partition
swapon [option] [DEVICE]
-A: Activate all swap partitions
-P: Set priority
Swapoff: Disable swap partition
swapoff [option] [DEVICE]
File system space occupancy Information viewing tool
df: View partition status
DF [OPTION] ... [FILE] ...
Options:
-A: Displays all file systems, including/proc and other file systems
-K: Display file system in Kbytes
-M: Display file system in MBytes
-H: Displayed in human readable form
-I: Displayed as the number of inode
-P: Output in POSIX-compatible format
Du
Du [OPTION] ... [FILE] ...
-K: Display file system in Kbytes
-M: Display file system in MBytes
-H: Displayed in human readable form
-A: Displays the capacity of all files and directories
5. File system mounted configuration file:/etc/fstab
Use the content shown in Cat/etc/fstab to define a file system for each row, with the contents of each line:
Device or pseudo-file to mount:
Device file, LABEL, UUID, pseudo file system name
Mount point
File system type
Mount option: Default
Dump frequency: 0 for no dump, 1 for daily dump, 2 for every other day dump
Self-Test sequence: 0 is not self-test, 1 is the first self-test, usually only/only 1
6. link file on file system
Hard links: Two paths to the same inode (not for directories and cross-partitions)
Symbolic Link: The data of a linked file points to another file path
LN:LN [-S] SRC DEST
This article is from the "Summer Month" blog, please make sure to keep this source http://lkc0110.blog.51cto.com/3410558/1694123
Linux Disk Management and file system management