How does a Vmware extended Disk not need to be restarted?

Source: Internet
Author: User

How does a Vmware extended Disk not need to be restarted?

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

References:

Http://thornelabs.net/2012/08/22/linux-rescan-scsi-bus.html

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.