首页 > 电脑教程 > Linux教程 > linux系统fdisk分区命令详解

linux系统fdisk分区命令详解

小编:动力软件园 时间:2018-12-18 16:29:14

1、首先查看分区

[root@localhost ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes

16 heads, 63 sectors/track, 83220 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: 0x00038e27

   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *           3        1018      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/vda2            1018       83221    41430016   8e  Linux LVM

Partition 2 does not end on cylinder boundary.

从上边信息可以看出vda硬盘已经经过分区

Disk /dev/vdb: 64.4 GB, 64424509440 bytes

16 heads, 63 sectors/track, 124830 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

vdb没有分区

 

Disk /dev/mapper/VolGroup-lv_root: 38.3 GB, 38260441088 bytes

255 heads, 63 sectors/track, 4651 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: 0x00000000

 

Disk /dev/mapper/VolGroup-lv_swap: 4160 MB, 4160749568 bytes

255 heads, 63 sectors/track, 505 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: 0x00000000

 

 

 

df只能查看已分区的信息

 

[root@localhost ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root

                       35G  1.2G   32G   4% /

tmpfs                 939M     0  939M   0% /dev/shm

/dev/vda1             477M   28M  425M   7% /boot

[root@localhost ~]#

 

2、使用分区命令

fdisk  /dev/vdb 

n

p

3、w 保存退出 并 fdisk -l查看

4、partprobe  强制执行partprobe保存分区表。centos下无法执行。未扎到原因。

5、mkfs -t ext4 /dev/vdb

6、挂载到新的空目录下,fdisk命令只能看到分区不能看到是否被挂载(想知道是否被挂载 必须使用mount或者df)

[root@localhost ~]# mkdir /data

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# mount /dev/vdb /data

7、每次重启都需要挂载分区,要修改fstab 实现自动挂载


相关阅读
排行榜
易学车老版本

易学车老版本

实用工具 下载
天行健安卓版 v2.35770

天行健安卓版 v2.35770

手游软件 下载
三星PC套件 samsung kies 官方正式版 3.2.15041.2

三星PC套件 samsung kies 官方正式版 3.2.15041.2

手机工具 下载