Rotten mud: [solution] After the LVM volume group name is modified and the system is restarted, it cannot enter the system.

Source: Internet
Author: User

Rotten mud: [solution] After the LVM volume group name is modified and the system is restarted, it cannot enter the system.

This article was sponsored by Xiuyi linfeng and first launched in the dark world.

The installation of a server system is complete, but the LVM volume group vg uses the default VolGroup name, which is uncomfortable to use. I plan to change the volume group name to vg.

Run the following command to view information about LVM in the system:

/Etc/fstab/etc/grub. conf

Df-h

Lvs

Vgs

We can see through. Currently, root partitions and swap partitions in the system are all in LVM, and only/boot partitions are separately separated. Therefore, after modifying the volume group name, the system cannot identify these mount points.

So how can the system identify these mount points? To let the system identify these mount points, we need to modify two files:/etc/fstab and/etc/grub. conf. Below I will introduce how to modify these two files.

In fact, it is very easy to modify the LVM volume group name. You only need to use the vgrename command. The usage is as follows:

Vgrename oldname newname

Start modifying the volume group name as follows:

Vgrename VolGroup vg

We can see that the original volume group name VolGroup in the system has been successfully changed to vg.

Next we will introduce how to modify the/etc/fstab and/etc/grub. conf files.

Vi/etc/fstab

We can see the volume group VolGroup used by the mount point in the system before the modification, the red part in the figure. Now we only need to change all the volgroups in this file to vg. As follows:

We can see that the current volume group vg is already active.

The above is the modification of the/etc/fstab file. Next, modify the/etc/grub. conf file as follows:

Vi/etc/grub. conf

The grub. conf file must be the same as the fstab file. modify all volgroups in the file to vg.

After the preceding modifications, we can restart the system as follows:

Shutdown-r now

After the system is restarted, we can see that the system has started properly.

Modify the name of the volume group. If the volume group name is not modified after modification, the files/etc/fstab and/etc/grub. conf are not modified. After the system is restarted, you will find that you cannot log on to the system and the following error message appears:

The system reports an error. At this time, we can only recover the system in the single-user mode of the system.

Restart the system and press the letter e when the system enters centos for several seconds to enter the GRUB editing status, as shown below:

Select the line starting with the word kernel and press the e key to edit the command line, as shown below:

Note: we need to change all volgroups in this line starting with the word kernel to the new volume group name vg, as shown below:

The modification is equivalent to modifying the/etc/grub. conf file to normal temporarily.

Enter a space single at the end and press enter as follows:

Then press the B key to load the file, as shown below:

After the system is started, the following interface is displayed. Enter the password of the root user here:

After entering the system normally, edit the/etc/fstab file and the system will prompt that the file cannot be written in the read-only status. As follows:

To edit the/etc/fstab file, you need to remount the root directory in the system to make it read/write. Run the following command:

Mount-o remount, rw/

The purpose of this command is to re-mount the root partition in the form of read/write.

Then edit the/etc/fstab file. As follows:

After the/etc/fstab file is modified, modify the/etc/grub. conf file. You will find that the system prompts you that the file is a new file. As follows:

Since the/etc/grub. conf file cannot be modified here, restart the system first. When the system is restarted, we also need to re-enter the single-user mode, and then modify all the volgroups in the line starting with the kernel to the new volume group name vg to start the system.

You will find that at this time we can normally enter the system and view the/etc/grub. conf file. As follows:

We can see that the current/etc/grub. conf file is still the name of the original volume group. Use the vi command to modify all volgroups in the file to vg. As follows:

After modifying the/etc/grub. conf file, restart and start again.

Now the system can be started properly, and the renaming of the LVM volume group has ended.

 


Adding logical volumes and volume groups to lvm

Lvcreate-n database-l 10 datastoremkfs. ext3/dev/datastore/databasevi/etc/fstab is modified according to the/file system class, and the last is 1 2 or more. The Graphical Method system-config-lvm is the easiest way to view the original post>

What is lvm used in linux?

Lvm is a linux logical volume group management technology used to manage disk partitions.
 

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.