Disk partitions and file systems

Disk partitions and file systems

Zoning role:

  1. Separate systems and procedures
  2. Install multiple os
  3. Using different file systems
  4. Improve the rate of repair

Mainstream partition MBR.GPT difference:

MBR: up to four primary partitions, extended partitions and logical partitions
  using a 32-bit sector
  partition size can not exceed the 2T

GPT: 128 partitions, all primary partition
 size of the largest 8Z
 automatic backup

Zoning command: fdisk, gdisk

fdisk command is divided to manage MBR partition, gdisk command division for the management of GPT partitions, use the two are basically the same, to take an example here fdisk

Use fdisk fdisk with a disk file into the command line, you can manage the disk partition file
input Options selection made:

    p  当前已有分区列表  
    t  更改分区类型  
    n  创建新分区  
    d  删除分区  
    w  保存退出  
    q  不保存退出  
    V  校验分区  
    u  转换单位(柱面与位)  

After a detailed input into the command line to view the help m
here to take to create a new partition, for example: Disk partitions and file systems
the Command (m for Help): the n-
represents the input operation to be carried out, n to create a new partition

     Partition type:
     p   primary (2 primary, 0        extended, 1 free)
     e   extended
     Select (default p): 

Represents a need to create a main partition or logical input select p primary partition, logical partition select input e ,, p displayed as a default, or may be directly input e p or the transport is the default

 First sector (39864320-41943039, default 39864320):

Wherein the values ​​represent the currently available cylinders, from which the cylinder begins dividing, general default to the transport

    Last sector, +sectors or +size{K,M,G} (39864320-41943039, default 41943039): +100M  

Herein represents the divided size selection, the cylinder number can be used, select several cylinders, also supports K \ M \ G, where I + is selected 100M, 100M size aside i.e.

Here it is divided over, you can view the current input p existing partition Disk partitions and file systems

Even heat may appear divided but without synchronization,
centos6 input partx -a / dev / sda synchronize
centos5,7 input oarw probe / dev / sda synchronize

File System: After the division of the partition can not be used, generally need to create a file system partition

blkid command to view all the current partition file system
mkfs command to create a file system

mkfs -t 指定文件系统类型  =mkfs.
     -b (1024/2048/4096)  指定块大小 1k,2k,4k。
     -L  设置卷标  
     -i 指定数据空间多少个字节创建一个inode  
     -N 指定分区中创建多少个inide  
     -I 一个inode记录占用的磁盘空间大小  128-4096  
     -m 指定为管理人员预留空间占总空间的百分比  

More current centos more commonly used ext4 file system can be created or xfs

示例: mkfs.xfs /dev/sda3    


Value can be reset ext filesystem series of adjustable parameters: tune2fs command

    -l  查看指定文件系统超级快信息  
    -L  修改LABEL,即卷标  
    -m  修改管理员预留空间  
    -U  修改UUID  

Create a complete file system, use the mount command to mount on a directory can be used

mount  将设备挂载在文件上作为访问入口  ,可使用设备名,UUID或卷标  
  umount /dev/sda3  取消挂载  或 umount /root
  mount /dev/sda3  /root  

-r  只读挂载  
-w  读写挂载  
-a  自动挂载所有支持自动挂载的设备,即写入/etc/fstab文件内,且挂在选项中有auto功能的设备  

If the file system corruption may have specified command to repair the file system:

  ! ! Note: The repair system must be unmounted, make repairs

fsck: use either the default repair tool to repair ext series
can also specify fsck.xfs xfs file system repair

    fsck -a  自动修复  
         -r  交互式修复  

e2fsck: ext series dedicated file system repair tool

    -y  自动回答y  
    -f  强制修复  
    -p  自动进行安全的修复文件系统   

xfs - repair: xfs file system-specific repair tool series

    -n  只检查  
    -d  允许修复只读的挂载设备,在单用户下修复根目录时使用,然后立即reboot

Guess you like

Origin blog.51cto.com/14322599/2417755
Recommended