vmware扩展linux磁盘分区

1、在vmware中扩展linux系统的磁盘分区,首先要做的就是扩展磁盘的容量



 

上面扩展的只是虚拟磁盘容量的大小,并没有增加linux系统分区和文件系统的大小(如上面标红所见)。

2、登录linux系统,利用刚刚扩展的磁盘新建分区

   2.1 查看已有分区

[root@cobub01 data]# fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x00051dc3

Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 549 4096000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 549 5222 37538816 83 Linux

   2.2 新建分区

[root@cobub01 ~]# fdisk /dev/sda

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): p

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 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: 0x00051dc3

Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 549 4096000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 549 5222 37538816 83 Linux

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

  注:· 上面在选择新建partition类型的时候,有extended和primary partion两种,此种选择了primary partion,如果选择extended会稍微麻烦些,读者可以自己去验证。

         ·  选择Firstt cylinder和Last cylinder大小的时候, 可以根据提示进行选择,默认选择最大利用了剩余的空间,此处选择默认,即直接回车即可。

  

扫描二维码关注公众号,回复: 319909 查看本文章

  2.3 挂在分区

[root@cobub01 ~]# mkdir /data
[root@cobub01 ~]# mount -t ext4 /dev/sda4 /data

  2.4 查看磁盘分区

[root@cobub01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 36G 18G 17G 52% /
tmpfs 1.4G 0 1.4G 0% /dev/shm
/dev/sda1 283M 66M 203M 25% /boot
/dev/sda4 20G 44M 19G 1% /data
[root@cobub01 ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext4 36818628 18004692 16936996 52% /
tmpfs tmpfs 1438528 0 1438528 0% /dev/shm
/dev/sda1 ext4 289293 67076 206857 25% /boot
/dev/sda4 ext4 20507336 44992 19413972 1% /data

看到上面的结果,恭喜你,你已经成功的完成扩展磁盘分区了!

猜你喜欢

转载自oitebody.iteye.com/blog/2253299