How Linux Expands Disks under VMware

  

On Linux systems, if you want to expand disk capacity, you can create new virtual disk space. After the new virtual disk is restarted, it will take effect. Of course, if you have any important tasks to perform and do not want to restart, there is a way. This article will introduce how Linux extends disks under VMware.

1: VMware Virtual Disk Expansion

As shown below, after VMware virtual disk expansion, you can't see any changes using fdisk -l

[root@localhost ~]# Fdisk -l

Disk /dev/sda: 171.7 GB, 171798691840 bytes

255 heads, 63 sectors/track, 20886 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 15665 125724690 8e Linux LVM

/dev/sda3 15666 15795 1044225 83 Linux

/dev/sda4 15796 20886 40893457+ 83 Linux

Disk /dev/dm-0: 126.6 GB, 126600871936 bytes

255 heads, 63 sectors/track, 15391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn‘t contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes

255 heads, 63 sectors/track, 257 cyli nders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev /dm-1 doesn & rsquo; t contain a valid partition table

Method 1: Echo 1 》 /sys/class/scsi_device/device/rescan

[root@localhost ~]# cd /sys/class/scsi_disk/

[root@localhost scsi_disk]# ls

0:0:0:0

[root@localhost scsi_disk]# cd 0\\:0\\:0\\:0/

[root@localhost 0:0: 0:0]# echo ‘1’ ” device/rescan

[root@localhost 0:0:0:0]# fdisk -l

Disk /dev/sda: 173.9 GB , 173946175488 bytes

255 heads, 63 sectors/track, 21147 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 15665 125724690 8e Linux LVM

/dev/sda3 15666 15795 1044225 83 Linux

/dev/sda4 15796 20886 40893457+ 83 Linux

Disk /dev/dm-0: 126.6 GB, 126600871936 bytes

255 heads, 63 sectors/track, 15391 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn<quo;t contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes

255 heads, 63 sectors /track, 257 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev /dm-1 doesn & rsquo; t contain a valid partition table

Method 2: Rescan specific SCSI Device

echo 1 》 /sys/block/$DEVICE/device/rescan Replace $DEVICE

with sda, sdb, sdc, etc. [root@ Localhost ~]# echo 1 》 /sys/block/sda/device/rescan

2: VMware added virtual disk

First find your host bus number

[ Root@localhost ~]# grep mpt /sys/class/scsi_host/host? /proc_name

/sys/class/scsi_host/host0/proc_name:mptspi

Use the following command to scan the SCSI bus

[root@localhost ~]# echo “- - -” 》 /sys/class/scsi_host/host0/scan

The above is how Linux expands the disk under VMware. Use the above two steps to expand the disk, no need to restart the system, the virtual disk Can be immediately recognized by the system.

Copyright © Windows knowledge All Rights Reserved