Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory

A physical server, using automatic partitioning the hard disk, so the root only 50G, / home directory there is a lot of space, the use of only 1%. And then expanded to increase hard disk root directory, there will be no problem, but now wants HOME directory space can be moved is the best solution to the root directory. Then Do It
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory

1, first delete the / home partition, back up to back up, I do not this, direct umonut, uninstall / home, if you can not uninstall, to terminate the process using the / home file system
fuser -km / home that I did not direct can umount / Home /
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
2, delete / lv home where
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
3, the expansion / root where lv, increase 500G
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
4, the expansion / root file system
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
to this root directory has been expanded well,
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
we found no, no HOME directory, because the front to deleted, and then back home to create a logical volume
5, re-create the home lv
this step many times do I have problems, take a look at the mining pit
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
behind -n is the name of the LV, suggesting no mapper volume group in fact, we name the volume group can be seen with the first line vgdisplay is "volGroup"
then joined the name of the volume group in the command, but still prompted two volume groups are not the same
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
relationship or volume group and the volume group did not got it right, went dev / mapper / view, did not find the volume name home, only root and swap
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
a look at some more information LV with lvdisplay. Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
Put under the command changed. lvcreate -L 100G -n lv_home VolGroup. Tip a success, but also to dev / mapper / see also VolGroup-lv_home. And delete the original name of the same.
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory
6, create a file system
mkfs.ext4 / dev / mapper / VolGroup- lv_home corresponds to format the partition
7, to mount Home
Mount / dev / Mapper / volgroup-lv_home
8, df -h look at before and did not delete the original are the same, this benefit is, / etc / fstab to mount in the / home directory without modification. Other LV logical volume was created, it should be possible just a name, and then modify the path to mount the home directory should be the same in the fstab inside.
Physical machine to install linux, full root directory, home directory is still very great, do not shut down the transit space to the root directory

Guess you like

Origin blog.51cto.com/1821342/2467659