Linux force the rereading of the disk geometry.

Assuming you know the device name of the disc you have expanded /dev/sdg then you can simply issue the following command to force the rereading of the disk geometry.

debian02:~ # echo 1 > /sys/class/scsi_device/0:0:6:0/device/rescan

To determine the SCSI ID from device names enter: ls -d /sys/block/sd*/device/scsi_device/* |awk -F '[/]' '{print $4,"- SCSI",$7}'

For example:
debian02:~ # ls -d /sys/block/sd*/device/scsi_device/* |awk -F '[/]' '{print $4,"- SCSI",$7}'
sda - SCSI 0:0:0:0
sdb - SCSI 0:0:1:0
sdc - SCSI 0:0:2:0
sdd - SCSI 0:0:3:0
sde - SCSI 0:0:4:0
sdf - SCSI 0:0:5:0
sdg - SCSI 0:0:6:0
sdh - SCSI 0:0:8:0
sdi - SCSI 0:0:9:0
sdj - SCSI 0:0:10:0
sdk - SCSI 0:0:11:0
sdl - SCSI 0:0:12:0
sdm - SCSI 0:0:13:0
sdn - SCSI 0:0:14:0
sdo - SCSI 0:0:15:0
debian02:~ #

Match Linux SCSI Devices (sdX) to Virtual Disks in VMware

To determine the SCSI ID from device names enter ls -d /sys/block/sd*/device/scsi_device/*

debian02:~ # ls -d /sys/block/sd*/device/scsi_device/*
/sys/block/sda/device/scsi_device/0:0:0:0 /sys/block/sde/device/scsi_device/0:0:4:0 /s
/sys/block/sdb/device/scsi_device/0:0:1:0 /sys/block/sdf/device/scsi_device/0:0:5:0 /s
/sys/block/sdc/device/scsi_device/0:0:2:0 /sys/block/sdg/device/scsi_device/0:0:6:0 /s
/sys/block/sdd/device/scsi_device/0:0:3:0 /sys/block/sdh/device/scsi_device/0:0:8:0 /s
debian02:~ #

You can see the the device name, and 4 numbers a:b:c:d

a = Hostadapter ID
b = SCSI channel
c = Device ID
d = LUN

The Device ID is always c. At the controller, it depends whether you are using the Paravirtual (b) controller, or the LSI Logic (a) controller.

On the VMware it looks like that:

debian02

/dev/sda has the SCSI ID 0:0:0:0 which is the equivalent to 0:0 and is Hard Disk 1 on VMware.
/dev/sde has the SCSI ID 0:0:4:0 which is the equivalent to 0:4 and is Hard Disk 5 on VMware.
/dev/sdo has the SCSI ID 0:0:15:0 which is the equivalent to 0:15 and is Hard Disk 16 on VMware.

When you remove and add disks, the order might change so always double check if you want to remove disks from a Virtual Machine.

Also you can use the following command if you want an output that is better to read:

debian02:~ # ls -d /sys/block/sd*/device/scsi_device/* |awk -F '[/]' '{print $4,"- SCSI",$7}'
sda - SCSI 0:0:0:0
sdb - SCSI 0:0:1:0
sdc - SCSI 0:0:2:0
sdd - SCSI 0:0:3:0
sde - SCSI 0:0:4:0
sdf - SCSI 0:0:5:0
sdg - SCSI 0:0:6:0
sdh - SCSI 0:0:8:0
sdi - SCSI 0:0:9:0
sdj - SCSI 0:0:10:0
sdk - SCSI 0:0:11:0
sdl - SCSI 0:0:12:0
sdm - SCSI 0:0:13:0
sdn - SCSI 0:0:14:0
sdo - SCSI 0:0:15:0
debian02:~ #

Boot Single User Mode – Resetting forgotten root user account password in RHEL/CentOS 6

While booting hit an arrow key, and it will take you to the GRUB menu. Again, use an arrow key to select the entry that you want to modify.
And hit “e” key to edit this. Find line which starts with “kernel“, and almost at the end of this line find “rhgb quiet“, and add “1” after “quiet“, so it will look like this: “rhgb quiet 1“. Once this is done hit enter. Now, it will take you to the kernel setting prompt. Just press “b” to boot from the kernel, and it takes you to the single user mode.

Now, you are in a single user mode, and you will be able to reset a root password, but before you do that check whether the SELinux is enabled or disabled.
Just type: “getenforce“. It has three contents: Enforcing – no permission to reset a root password. Permissive – permission to rest a root password, and Disabled – No policies are loaded. If you have Enforcing enabled you can disable it by using the following command: “setenforce 0“.
Once this is done, you can change a root password 🙂