vmware extend linux disk partition

 

1. To expand the disk partition of the Linux system in vmware, the first thing to do is to expand the capacity of the disk



 

The above expansion is only the size of the virtual disk capacity, and does not increase the size of the Linux system partition and file system (as seen in red above).

 

2. Log in to the Linux system and create a new partition using the newly expanded disk

   2.1 View existing partitions

[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 Create a new partition

[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

  Note: · When selecting the new partition type above, there are two types: extended and primary partion. In this case, primary partion is selected. If extended is selected, it will be a little more troublesome. Readers can verify it by themselves.

         · When selecting the size of Firstt cylinder and Last cylinder, you can choose according to the prompts. The default selection maximizes the use of the remaining space. Select the default here, that is, just press Enter.

  

  2.3 Hanging on the partition

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

  2.4 View disk partitions

[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

 

Seeing the above results, congratulations, you have successfully completed extending the disk partition!

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326975546&siteId=291194637