XenSystem 系统有个不好的地方,就是新开通的VPS或者重新安装系统后的VPS,硬盘空间都没有挂载,需要自己手动挂载一下。以下是完整的挂载记录
查看硬盘分区情况
fdisk -l df -hal #查看已划分区空间使用情况
添加整个物理硬盘到lvm
pvcreate /dev/xvdb #添加整个物理硬盘xvdb到lvm vgextend VolGroup00 /dev/xvdb #添加整个物理硬盘xvdb到LVM卷VolGroup00 vgdisplay #查看结果 #lvresize -L +20.00G /dev/VolGroup00/LogVol00 #扩展20G硬盘 这里出现错误,不需要执行 lvresize -L +19.96G /dev/VolGroup00/LogVol00 #扩展硬盘20G 略微有个差数 resize2fs /dev/VolGroup00/LogVol00 重置LVM大小
附加说明
也可以对/dev/xvdb分区再加入LVM。 我这里是直接把硬盘整个的加入LVM了。
创建分区:
fdisk /dev/xvda n 输入n新建分区 p 输入p,主分区 3 由上图的fdisk -l可以看到硬盘已经有两个分区,我们这里输入3,第三个分区 t 通过t来指定分区系统格式 3 第3个分区(如果你就建了一个分区就不要输入3了它会自动选择的.跳过这一步) 8e 输入8e,LVM系统格式 w 输入w保存退出 reboot 重启使之生效
加入分区:
pvcreate /dev/xvda3 #创建物理卷 vgextend VolGroup00 /dev/xvda3 #将物理卷加入到组VolGroup00
完整的命令交互记录
[root@MyVPS ~]# fdisk -l Disk /dev/xvda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvda1 * 1 13 104391 83 Linux /dev/xvda2 14 1044 8281507+ 8e Linux LVM /dev/xvda3 1045 1305 2096482+ 8e Linux LVM Disk /dev/xvdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/xvdb doesn't contain a valid partition table [root@MyVPS ~]# df -hal Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 9.3G 1.8G 7.1G 20% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts /dev/xvda1 99M 36M 58M 39% /boot tmpfs 513M 0 513M 0% /dev/shm none 0 0 0 - /proc/sys/fs/binfmt_misc sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs [root@MyVPS ~]# vgdisplay --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 9.84 GB PE Size 32.00 MB Total PE 315 Alloc PE / Size 315 / 9.84 GB Free PE / Size 0 / 0 VG UUID ONGPxy-HBvY-xrrQ-IjEW-PIiO-2cX7-tg6tuI [root@MyVPS ~]# pvcreate /dev/xvdb Physical volume "/dev/xvdb" successfully created [root@MyVPS ~]# vgextend VolGroup00 /dev/xvdb Volume group "VolGroup00" successfully extended [root@MyVPS ~]# vgdisplay --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 3 Metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 3 Act PV 3 VG Size 29.81 GB PE Size 32.00 MB Total PE 954 Alloc PE / Size 315 / 9.84 GB Free PE / Size 639 / 19.97 GB VG UUID ONGPxy-HBvY-xrrQ-IjEW-PIiO-2cX7-tg6tuI [root@MyVPS ~]# lvresize -L +20.00G /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 29.59 GB Insufficient free space: 640 extents needed, but only 639 available [root@MyVPS ~]# lvresize -L +19.96G /dev/VolGroup00/LogVol00 Rounding up size to full physical extent 19.97 GB Extending logical volume LogVol00 to 29.56 GB Logical volume LogVol00 successfully resized [root@MyVPS ~]# resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol00 to 7749632 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol00 is now 7749632 blocks long.
最新评论