How does VMware extend the disk without restarting the system?

Source: Internet
Author: User

How does VMware extend the disk without restarting the system?

In the virtual machine VMware, we sometimes need to add new virtual disks or expand existing Virtual Disks (expand). After adding new disks or disk resizing, the Linux system cannot recognize them immediately. That is to say, you cannot see disk space changes (use fdisk-l to view). In this case, you can restart the system (reboot) to solve this problem. However, many times, we do not want to restart the system during storage resizing because this will affect the existing business system. So why can't Linux recognize new disks or resize disks? This is because the SCSI bus connecting to the storage device needs to be re-scanned to identify these new storage devices. Next, we will test how to add a new virtual disk or resize an existing virtual disk to avoid restarting the system.

1: VMware Virtual Disk resizing

As shown in the following figure, the fdisk-l cannot be used to see any changes after the VMware Virtual Disk is resized.

[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 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
 
Disk/dev/dm-1 doesn'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'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't contain a valid partition table

Method 2: rescan a specific SCSI Device

Echo 1>/sys/block/$ DEVICE/device/rescan Replace $ DEVICE with sda, sdb, and sdc

[Root @ localhost ~] # Echo 1>/sys/block/sda/device/rescan

2: VMware new 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

Run the following command to scan the SCSI bus:

[Root @ localhost ~] # Echo "---">/sys/class/scsi_host/host0/scan

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.