查看已经挂载的分区和文件系统类型

[root@VM_101_18212122_centos /]# df -T     
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/vda1     ext3    20641404  13449448   6143440  69% /

 

fdisk -l 可以显示出所有挂载和未挂载的分区,但不显示文件系统类型

[root@VM_101_18212122_centos /]# fdisk -l // 查看磁盘

Disk /dev/vda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072b28

   Device Boot      Start         End      Blocks   Id  System    //设备启动端块ID系统
/dev/vda1   *           1        2611    20970496   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes      // 这块磁盘没有设备 是因为没有挂载
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 

fdisk 命令进行建立分区

磁盘分区分为:主分区、扩展分区、逻辑分区;主分区至少有1个,最多4个;扩展分区可以没有,最多1个

主分区+扩展分区 最多不得超过4个,如果需要多个分区可以先建立扩展分区,在扩展分区中划分多个逻辑分区

执行分区步骤可以根据 :fdisk 命令   Linux下磁盘挂载  这2篇博客文章操作

自定义当前第几块分区注意:Partition number(1-4) :number  这个数字是指在当前这块硬盘上第几个分区

[root@VM_101_18212122_centos ~]# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf3de3926.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1   // 第一个分区
First cylinder (1-208050, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-208050, default 208050): +50G

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf3de3926

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1      104026    52429072+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 1  // 这里必须至少从2 开始
Partition 1 is already defined.  Delete it before re-adding it.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 2
First cylinder (104027-208050, default 104027): 
Using default value 104027
Last cylinder, +cylinders or +size{K,M,G} (104027-208050, default 208050): 
Using default value 208050

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf3de3926

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1      104026    52429072+  83  Linux
/dev/vdb2          104027      208050    52428096    5  Extended


Command (m for help): p  // 打印磁盘情况

Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf2295fd0

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1      104026    52429072+  83  Linux
/dev/vdb2          104027      208050    52428096   83  Linux

Command (m for help): w  // 保存
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@VM_101_182121222_centos ~]# fdisk -l

Disk /dev/vda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00072b28

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        2611    20970496   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf2295fd0

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1      104026    52429072+  83  Linux
/dev/vdb2          104027      208050    52428096   83  Linux
View Code

相关文章:

  • 2021-09-08
猜你喜欢
  • 2022-01-06
  • 2021-06-17
  • 2021-04-09
  • 2021-09-10
相关资源
相似解决方案