In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to add a new hard disk for VMware Linux client without restarting. The content of the article is of high quality, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.
As a system administrator, I often need additional hard drives to expand storage or separate system data from user data. I'll show you how to add a hard disk from a host to a Linux client virtualized with VMWare software in the process of adding physical block devices to virtual hosts.
You can explicitly add or remove a SCSI device, or rescan the entire SCSI bus without restarting the Linux virtual machine. This guide was tested in VMware Server and VMware Workstation v6.0 (older versions should also support it). All commands have been tested on RHEL, Fedora, CentOS and Ubuntu Linux client/host operating systems.
Step 1: Add a new hard disk to the virtual client
First, add a hard drive through the vmware hardware settings menu. Click VM > Settings
Vmware Virtual Machine Settings
Or you can press CTRL + D to enter the Settings dialog.
Click "Add" to add a new hard disk to the client:
VMWare adding a new hardware
Select Hardware Type as "Hard disk" and click "Next":
VMware Adding a new disk wizard
Select "Create a new virtual disk" and click "Next":
Vmware Wizard Disk
Set the virtual disk type to SCSI and click Next:
Vmware Virtual Disk
Set the *** disk size as desired and click "Next"
Finalizing Disk Virtual Addition
Select the file location and click Finish.
Step 2: Rescan the SCSI bus and add SCSI devices without restarting the virtual machine
Rescan the SCSI bus by entering the following command:
echo "- - -" > /sys/class/scsi_host/host# /scanfdisk -ltail -f /var/log/message
The output is:
Linux Vmware Rescan New Scsi Disk Without Reboot
You need to replace host#with a real value, such as host0. You can find this value by issuing the following command:
# ls /sys/class/scsi_host
Output:
host0
Then enter the following command to request a rescan:
echo "- - -" > /sys/class/scsi_host/host0/scanfdisk -ltail -f /var/log/message
The output is:
Jul 18 16:29:39 localhost kernel: Vendor: VMware, Model: VMware Virtual S Rev: 1.0Jul 18 16:29:39 localhost kernel: Type: Direct-Access ANSI SCSI revision: 02Jul 18 16:29:39 localhost kernel: target0:0:1: Beginning Domain ValidationJul 18 16:29:39 localhost kernel: target0:0:1: Domain Validation skipping write testsJul 18 16:29:39 localhost kernel: target0:0:1: Ending Domain ValidationJul 18 16:29:39 localhost kernel: target0:0:1: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)Jul 18 16:29:39 localhost kernel: SCSI device sdb: 2097152 512-byte hdwr sectors (1074 MB)Jul 18 16:29:39 localhost kernel: sdb: Write Protect is offJul 18 16:29:39 localhost kernel: sdb: cache data unavailableJul 18 16:29:39 localhost kernel: sdb: assuming drive cache: write throughJul 18 16:29:39 localhost kernel: SCSI device sdb: 2097152 512-byte hdwr sectors (1074 MB)Jul 18 16:29:39 localhost kernel: sdb: Write Protect is offJul 18 16:29:39 localhost kernel: sdb: cache data unavailableJul 18 16:29:39 localhost kernel: sdb: assuming drive cache: write throughJul 18 16:29:39 localhost kernel: sdb: unknown partition tableJul 18 16:29:39 localhost kernel: sd 0:0:1:0: Attached scsi disk sdbJul 18 16:29:39 localhost kernel: sd 0:0:1:0: Attached scsi generic sg1 type 0Jul 18 16:29:39 localhost kernel: Vendor: VMware, Model: VMware Virtual S Rev: 1.0Jul 18 16:29:39 localhost kernel: Type: Direct-Access ANSI SCSI revision: 02Jul 18 16:29:39 localhost kernel: target0:0:2: Beginning Domain ValidationJul 18 16:29:39 localhost kernel: target0:0:2: Domain Validation skipping write testsJul 18 16:29:39 localhost kernel: target0:0:2: Ending Domain ValidationJul 18 16:29:39 localhost kernel: target0:0:2: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)Jul 18 16:29:39 localhost kernel: SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)Jul 18 16:29:39 localhost kernel: sdc: Write Protect is offJul 18 16:29:39 localhost kernel: sdc: cache data unavailableJul 18 16:29:39 localhost kernel: sdc: assuming drive cache: write throughJul 18 16:29:39 localhost kernel: SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)Jul 18 16:29:39 localhost kernel: sdc: Write Protect is offJul 18 16:29:39 localhost kernel: sdc: cache data unavailableJul 18 16:29:39 localhost kernel: sdc: assuming drive cache: write throughJul 18 16:29:39 localhost kernel: sdc: unknown partition tableJul 18 16:29:39 localhost kernel: sd0:0:2:0: Attached scsi disk sdcJul 18 16:29:39 localhost kernel: sd0:2:0: Attached scsi generic sg2 type 0 How to delete/dev/sdc this device?
In addition to rescan the entire bus, you can also add or remove specific disks using the following commands:
# echo 1 > /sys/block/devName/device/delete# echo 1 > /sys/block/sdc/device/delete How do I add/dev/sdc this device?
Add the specified device using the following syntax:
# echo "scsi add-single-device " > /proc/scsi/scsi
Here,
: Host
: Bus (channel)
: Target (Id)
: LUN number
For example. To add/dev/sdc using parameters host#0, bus#0, target#2, and LUN#0, enter:
# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi# fdisk -l# cat /proc/scsi/scsi
Result output:
Attached devices:Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02Host: scsi0 Channel: 00 Id: 01 Lun: 00 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02Host: scsi0 Channel: 00 Id: 02 Lun: 00 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02 Step #3: Format a New Disk
Now use fdisk and create partitions with the mkfs.ext3 command:
# fdisk /dev/sdc### [if you want ext3 fs] ### mkfs.ext3 /dev/sdc3### [if you want ext4 fs] ### mkfs.ext4 /dev/sdc3 Step #4: Create mount point and update/etc/fstab# mkdir /disk3
Open the/etc/fstab file and type:
# vi /etc/fstab
Add the following line:
/dev/sdc3 /disk3 ext3 defaults 1 2
For ext4 file systems, add:
/dev/sdc3 /disk3 ext4 defaults 1 2
Save and close the file.
Optional action: Label partitions
You can label partitions using the e2label command. Suppose you want to label the new partition/backupDisk, enter:
# e2label /dev/sdc1/backupDisk How to add a new hard disk to a VMware Linux client without restarting is shared here. I hope the above content can help you and learn more. If you think the article is good, you can share it so that more people can see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.