Linux disk and file system management
It is still important for disks and file systems, because all the data is stored in the disk. The correct partition of the disk and the management of the file system are summarized in my own notes, we hope you can provide more support.
I. Disk and partition management tools
For example,/dev/sdb2/dev is the directory where all hardware information is stored. sd represents the disk/USB device of the SCSI interface (hd represents the disk of the IDE interface/SATA interface) B indicates the number of disks. 2 indicates the second disk, and 2 indicates the second partition. the primary partition is 1, 2, 3, and 4 logical partitions numbered from 5, and 5 is the first logical partition.
Fdisk-l # view system disk information [root @ localhost ~] # Fdisk-l Disk/dev/sda: 53.7 GB, 53687091200 bytes255 heads, 63 sectors/track, 6527 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x0000cefb Device Boot Start End Blocks Id System/dev/sda1 * 1 64 512000 83 LinuxPartition 1 does not end on cylinder boundary. /dev/sda2 64 6528 8e Linux LVMDisk/dev/mapper/VolGroup-lv_root: 51915776 GB, 49.0 bytes255 heads, 63 sectors/track, 5952 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00000000Disk/dev/mapper/VolGroup-lv_swap: 4194 MB, 4194304000 bytes255 heads, 63 sectors/track, 509 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00000000
- Plan Hard Disk Partitions
Fdisk device name
fdisk /dev/sda2
Important parameters in the interactive interface: p lists partitions in the hard disk. n creates a partition. P primary partition. E extended partition. L logical partition. d. Delete partition. t. Change partition type. ext3 ---- 83, SWAP--82, fat32 ----- B, lvm ----- 8el view partition type code list w save quit q exit not save
- Re-detect disk partition changes:
Partprobe device name # parparobe/dev/sda2 partx-a device name # partx-a/dev/sda1
If no device file is generated, restart the system.
Mkfs-t file system type partition name
Mkfs-t ext3/dev/sdb1 Mkfs. ext3/dev/sdb1 mkswap format swap partition (swap partition)
A. Manually Mount
Mount-t file system device name mount point (must be a folder)
Mount-o loop mounting iso image files
The mount-t iso9660 mounting disc can be left blank with the device name:/dev/cdrom or
/Dev/hdc
B. automatic mounting upon startup: edit the/etc/fstab file
The meaning of the six fields in this file must be clearly written.
The first column is the device number or the second column is the mount point of the device.
Column 3: File System Column 4: File System Parameters
Column 5 shows whether the backup can be performed using the demp command. 0: no backup, 1: backup, 2: backup, but less important than 1. After this parameter is set, you can back up the corresponding mount point when using the dump command to back up the system in Linux.
Column 6 checks the partition with fsck when the system is started. Some mount points do not need to be verified, such as the Virtual Memory swap and/proc. 0: no check. 1: Check is required. 2: Check is required. However, if the root directory is set to 1 and other values are set to 2, check is performed later.
Mount-a to check whether the change is correct [if it is correct, it will be automatically mounted. If it is not correct, an error will be reported]
Df-hT viewing disk usage h is easy to read, T shows the type of the corresponding File System
- Enable or disable swap partitions
Swapon partition name enable swap partition swapoff partition name disable swap Partition
In the verification process, first use free to view the system memory usage and then enable it, And then view the usage or cat/proc/meminfo
In Linux, mount NTFS partitions, FAT16 and FAT32, as long as they are mounted with mount. NTFS requires the installation of NTFS support software.
Operation Procedure: Tar zxf tar package-C/usr/srcCd/usr/src/ntfs. /configure Make & amp; make installln-s/bin/ntfs-3g/sbin/mount. ntfs # create a symbolic link to mount an existing ntfs partition. Check the partition and mount it to Fdisk-l mount.
So much is written about disk and file system management and will be updated later.
For more details, please continue to read the highlights on the next page: