很多用户在XenSystem的默认模版CentOS7默认挂载到/home,无法挂载/www

按如下操作

查看卷组相关信息

 [root@MyCloudServer ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "Xvdbgroup" using metadata type lvm2
  Found volume group "centos" using metadata type lvm2

查看卷组VolGroup00包含的PV、LV信息。

[root@MyCloudServer ~]# vgdisplay -v Xvdbgroup
    Using volume group(s) on command line.
  --- Volume group ---
  VG Name               Xvdbgroup
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               30.00 GiB
  PE Size               4.00 MiB
  Total PE              7679
  Alloc PE / Size       7655 / 29.90 GiB
  Free  PE / Size       24 / 96.00 MiB
  VG UUID               PBc5Xq-pQ61-L618-h8Nd-31oE-RmuB-qlaEyv
     --- Logical volume ---
  LV Path                /dev/Xvdbgroup/xvdb1
  LV Name                xvdb1
  VG Name                Xvdbgroup
  LV UUID                vgJbGW-UZAe-zM8y-HRcE-c5f6-PKpk-mh3lPU
  LV Write Access        read/write
  LV Creation host, time MyCloudServer, 2018-12-09 20:12:17 +0800
  LV Status              available
  # open                 1
  LV Size                29.90 GiB
  Current LE             7655
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Physical volumes ---
  PV Name               /dev/xvdb1     
  PV UUID               ht2z0o-yINv-08WR-crWy-oeff-PXh6-IOGbMK
  PV Status             allocatable
  Total PE / Free PE    7679 / 24

卸载卷组上的逻辑卷LV
要卸载对应卷组VG的所有逻辑卷LV。从上面的信息可以看出对应的卷组VolGroup00只有/dev/VolGroup00/iscsi00这个逻辑卷LV

[root@MyCloudServer ~]# umount /dev/Xvdbgroup/xvdb1

删除逻辑卷LV

[root@MyCloudServer ~]# lvremove /dev/Xvdbgroup/xvdb1 
Do you really want to remove active logical volume xvdb1? [y/n]: y
  Logical volume "xvdb1" successfully removed

删除卷组VG

[root@MyCloudServer ~]# vgremove Xvdbgroup
  Volume group "Xvdbgroup" successfully removed

验证卷组(VG)是否删除 剩下centos 卷组是对的

[root@MyCloudServer ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "centos" using metadata type lvm2

删除物理卷PV

[root@MyCloudServer ~]# pvremove /dev/xvdb1 
  Labels on physical volume "/dev/xvdb1" successfully wiped

编辑 /etc/fstab 删除对应挂载点信息
这里没有安装nano yum install nano 笔者喜欢用nano

[root@MyCloudServer ~]# nano /etc/fstab 
-bash: nano: command not found
[root@MyCloudServer ~]# yum install nano

看到/etc/fstab里面没有什么需要删的,Ctrl+x退出nano不用保存,
下面是格式化/dev/xvdb为ext4的格式

    [root@MyCloudServer ~]# mkfs.ext4 /dev/xvdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2155872256
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

接下来就可以用一健脚本完成挂载

yum install wget -y && wget -O auto_disk.sh http://download.bt.cn/tools/auto_disk.sh && bash auto_disk.sh

可以查看df 和nano /etc/fstab 有没有成功,成功了就可以reboot了

下次重装时只选择格式化系统盘,再次挂载数据不会丢失
mkdir /www
mount /dev/xvdb1 /www
echo "/dev/xvdb1 /www ext4 defaults 1 3" >> /etc/fstab
以上命令可以重新挂载/www分区,如果你是小白,数据很重要,建议备份了再试。