Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add a new disk to CentOS7 without rebooting the system

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to add a new disk in CentOS7 without restarting the system, the content is very detailed, interested friends can refer to, hope to be helpful to you.

For most system administrators, expanding the disk space of the Linux server is one of the daily tasks.

1. Virtual machine clients expand disk space:

Before adding disk volumes to your Linux system, you first need to add a new physical disk or set it up in your VMwarevShereVMwar workstation and other virtual environment software you use to increase the capacity of a virtual disk.

two。 Check disk space:

Run the following command to check the current disk space.

# df-h # fdisk-l

3. Expand the space without restarting the virtual machine

Now run the following command, by rescanning the SCSI Note: SmallComputSystemInterfac small computer system Interface) bus and adding SCSI devices, the system can expand the physical volume disk space of the operating system without rebooting the virtual machine.

# ls / sys/class/scsi_host # echo "- -" > / sys/class/scsi_host/host0/scan # echo "-" > / sys/class/scsi_host/host1/scan # echo "- > / sys/class/scsi_host/host2/scan

Use the following command to check the name of the SCSI device, and then rescan the SCSI bus.

# ls/sys/class/scsi_device/ # echo1 > / sys/class/scsi_device/0:0:0:0/device/rescan # echo1 > / sys/class/scsi_device/2:0:0:0/device/rescan

As shown in the following figure, the SCSI bus is rescanned, and then the disk size set by my virtual machine client will display normally. 4. Create a new disk partition:

Once you can see the expanded disk space in the system, you can run the following command to format your disk to create a new partition. Follow the steps below to expand your physical disk volume.

# fdisk/dev/sdaWelcomtofdiskutil-linux2.23.2pressthe'm'keiforhelpCommandmforhelp:mCommandactionatogglabootablflagbeditbsddisklabelctogglthedocompatflagddeletapartitiongcreatanewemptiGPTpartittableGcreatanIRIXSGIpartittablellistknownpartittypesmprintthimenunaddanewpartitionocreatanewemptiDOSpartittablepprintthepartittableqquitwithoutsavechangescreatanewemptiSundisklabeltchangapartition'systemiduchangdisplay/entriunitsvverifithepartittablewwritetabltodiskandexitxextrafunctionexpertonliCommandmforhelp:

Type'p'to view the current partition table information, and then type the'n 'key to create a new primary partition, select all available sectors, use the' t 'command to change the disk type to' LinuxLVM' and then select the encoding'8e'or leave it unselected by default, the default type encoding is'83'.

5. Create a physical volume:

According to the above prompts, run the 'partprob' or' kpartx' command to make the partition table effective, and then use the following command to create a new physical volume.

# partprobe # pvcreat/dev/sda3

To check the newly created volume, run the following command to see if the new physical volume has been created and whether it is available. Next, you can use this new physical volume to extend the 'centos' volume group, as shown below:

# pvdisplay # vgextendcento/dev/sda3

6. Extend logical volumes:

Now use the following command to expand the logical volume to increase the disk space that my system is using. 7. Expand the root partition by adding new disks without rebooting the system:

This is the second method, using a very simple command to increase the size of the logical volume space on the CentOS7 system. So the * step is to open the settings page of your virtual machine client, click the add button, and then proceed to the next step.

# ls/sys/class/scsi_device/#echo1 > / sys/class/scsi_device/1:0:0:0/device/rescan # echo1 > / sys/class/scsi_device/2:0:0:0/device/rescan # echo1 > / sys/class/scsi_device/3:0:0:0/device/rescan # fdisk-l

The process of managing disk partitions on LinuxCentOS7 systems is very simple. You can use the methods described in this article to expand the disk space of any of your logical volumes. You don't need to restart the server on the production line, just simply rescan the SCSI device and extend the LVM logical volume management you want.

On how to add a new disk in CentOS7 without rebooting the system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report