linux hard disk partition format and mount
1, hard disk interface type
Hard disk interface is generally divided into two types, one is IDE parallel interface, one is SATA serial interface, the hard disk of IDE interface above linux is recognized as device such as /dev/hd[az], where hdc represents optical drive device, this is because there are generally two IDE plugs on the motherboard. Slot, an IDE slot can connect two hard drives, and the optical drive is on the first interface above the IDE's second slot. Other devices such as SCSI, SAS, SATA, USB, etc. are recognized as /dev/sd[a-z] in Linux.
2, Linux hard disk partition
Disk partition is divided into: primary (primary partition), extended (extended partition), Logical (logical partition) and the primary partition plus extended partition The number is less than or equal to 4. And there is only one extended partition, the extended partition can not directly write data in it, the new logical partition in the extended partition can read and write data. If you see a hard disk with many partitions, it is actually a new logical partition in the extended partition.
The primary partition from sdb1--sdb4
The logical partition is from sdb5--sdbN
If the relationship between the Linux hard disk partitions shown
< Br>
The first case is: four primary partitions
The second case is: three primary partitions + An extended partition (including logical partitions in the extended partition)
3, how to implement partition on Linux
Linux partition implementation command: fdisk
1) fdisk -l [DEVICE]
View the information of a linux hard disk fdisk -l /dev/[hs]d[az], not the device name, the default is to view the information of all hard disks.
2) fdisk DEVICE can partition the hard disk
[root@Redhat5 ~ ~]# fdisk /dev/sda
Command (m For help): m (enter m to see the menus that can be manipulated)
Command action
a toggle a bootable flag
b edit bsd disklabel
c Toggle the dos compatibility flag
d delete a partition //delete a partition
l list known partition types //list of known partition types
m print this menu< Br>
n add a new partition //Add a new partition
o create a new empty DOS partition table
p print the partition table //print partition table
q quit without saving changes //Exit without saving the configuration
s create a new empty Sun disklabel
t change a partition"s system id //Change the system ID of a partition
u change display/entry units //Change display/entry units
v verify the partition table //Verify partition table
w write table to disk and exit //Save exit
x extra functionality (experts Only)
Common linux supported partition types are 82 swap swap partition, 83 linux partition, 8e LVM logical volume group.
After the partition is modified, type w to save and exit. At this time, the partition can not be used, because the Linux kernel does not recognize the partition information
4, the Linux kernel recognizes the partition information
cat /proc/partitions View the partition information recognized by the kernel
[root@Redhat5 ~]# cat /proc/partitions
major minor #blocks name
8 0 125829120 sda
8 1 104391 sda1
8 2 41945715 sda2
8 3 1052257 sda3
253 0 30703616 dm-0
253 1 5111808 dm-1
There are two commands for the kernel to re-read the hardware partition table
partprobe /dev/sda ------> redhat 5.x, redhat 6.x needs to be restarted
partx -a /dev/sda5 /dev/sda------->redhat 6.x
After the kernel loads the partition information, check
[root@Redhat5 ~]# cat /proc/partitions
major minor #blocks name
8 0 125829120 sda
8 1 104391 sda1
8 2 41945715 sda2
8 3 1052257 sda3
8 4 0 sda4
8 5 1959898 sda5
8 6 3911796 sda6
< Br>
253 0 30703616 dm-0
253 1 5111808 dm-1
5, Format Partition
Command to format partitions
mkfs -t fstype /dev/part -tSelect the type of formatting, then which partition
mkfs.ext2 /dev/part Format For the type of ext2, then connect to that partition
mkfs.ext3 /dev/part formatted as ext3 type, then connect to that partition
mkfs.ext4 /dev/part format For the type of ext4, then the partition is
mke2fs is a more powerful format partitioning command than the previous ones
The relationship between these commands
mkfs -t ext4 = mkfs.ext4 = mke2fs -t ext4
mkfs -t ext3 = mkfs.ext3 = mke2fs -j = mke2fs -t ext3
mkfs - t ext2 = mkfs.ext2 = mke2fs = mke2fs -t ext2
mke2fs (man mke2fs): create file type --->>/etc/mke2fs.conf configuration file
-t: file type
-j: equivalent to ext3
-b: specify block size {1024"2048|
4096byte}, the block size depends on cpu support for memory page frame size, x86 system default page
size is 4096,4k
-L: label set volume label
-m: #The ratio of blocks reserved for management is generally used when the partition is large, #为数字
mke2fs -t ext3 /dev/sda5 #分区The format is ext3 format mke2fs -t ext3 -b 2048 /dev/sda5 # Change the block of the partition to 2048 bytes, generally used in the case of a lot of small files in the system mke2fs -t ext3 -m 3 /dev/sda5 #分区The reserved space is changed to 3% of the total space. The default is 5%, because when a partition is large enough, you can reduce the space. mke2fs -t ext3 -L DATE /dev/sda5 #Set the partition's volume label For the DATEtune2fs command, you can view the details of the partition. The relationship between mke2fs and tune2fs is similar to the relationship between useradd and usermod. Most of the tune2fs supported by mke2fs are supported. For details, please visit man tune2fs for related help.
option
-l: Display file system superblock information;
-L label: reset volume label;
-m #: Adjust the proportion of the total space occupied by the blocks reserved for management;
-r #: Adjust the number of blocks reserved for management;
-o: Setting the default option for mounting
-O: Setting the default properties of the file system
-E: Adjusting the extended attributes of the file system
tune2fs does not support the -b parameter change block the size of.
tune2fs -l /dev/sda5 You can view the partition information in detail
[root@Redhat5 ~]# tune2fs -l /dev/sda5 | Grep "^Block size" //Display the size of the sda5 partition block. Block size: 4096[root@Redhat5 ~]# tune2fs -l /dev/sda5 | Grep "^Reserved" //Show sda5 reserved space Reserved block count: 24498Reserved GDT blocks: 119Reserved blocks uid: 0 (user root)Reserved blocks gid: 0 (group root)
I have used the inux system to forget the root password. What should I do if I encounter suc
There are a lot of posts on the network about how to install Sogou input method on Ubuntu, but it se
Install JDK in fact only need to get two problems, the installation directory and configuration file
Yesterday I received the zabbix alarm email, the usage rate of a servers /home directory re
Linux forgot the root password solution
Install jdktomcat under linux and configure
9 Linux commands that must be carefully used before use
Static library generation and use under Linux
How to use Linux anonymously online - four magic weapons
Linuxshell implements script to automatically clean up rman backup files
Linux system main directory role
How to create and unzip zip, tar, tar.gz and tar.bz2 files under Linux
Problems that newbies may encounter when adding users and deleting users in Linux
How does Linux extend the XFS file system?
Easily uninstall WinXP/2000/2003
Win8.1 system desktop speaker icon is missing the solution
WIN8 tablet fast 10 commonly used shortcut keys
Quickly check the wireless network password under Windows 7
The gap between Win7 versions is
Windows10 boot skip operation screen of the lock screen
Teach you telnet default root path change stunt