如何在 centos 6.4 KVM 服务器上挂载磁盘

如何在 centos 6.4 KVM 服务器上挂载磁盘

我的 KVM 服务器上已装有 Centos 6.4,并运行着几个网站,现在我的空间快用完了,所以我决定从服务器提供商那里购买更多 GB 的空间以增加 HDD。我联系了服务器提供商,他们告诉我必须自己安装它,但说实话,即使我用 google 搜索,似乎也不太清楚我要做什么......或者更好地说什么是最好和最简单的方法来做这件事。服务器提供商的网站上有一个指南,但我认为它不适用于我的情况,我开始遵循指南,但从第一个命令开始似乎与结果不匹配,这是我所做的:来自服务器提供商的示例:fdisk -ul /dev/vdb 结果应该是有关磁盘是否扩展的信息来自我的服务器:fdisk -ul /dev/vdb 结果是空白的没有数据

因此此时我执行了 df -l 并且输出为:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_SERVER-lv_root 16070076 4696580 10557164 31% / tmpfs 961212 0 961212 0% /dev/shm /dev/vda1 495844 73767 396477 16% /boot

我执行 fdisk -l 后输出为:

Disk /dev/vda: 214.7 GB, 214748364800 bytes
16 heads, 63 sectors/track, 416101 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000a608e

Device Boot Start End Blocks Id System /dev/vda1 * 3 1018 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 1018 41611 20458496 8e Linux LVM Partition 2 does not end on cylinder boundary.

Disk /dev/mapper/vg_SERVER-lv_root: 16.7 GB, 16718495744 bytes 255 heads, 63 sectors/track, 2032 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

Disk /dev/mapper/vg_SERVER-lv_swap: 4227 MB, 4227858432 bytes 255 heads, 63 sectors/track, 514 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

好的,命令应该是 fdisk -ul /dev/vda,结果是:

 Disk /dev/vda: 214.7 GB, 214748364800 bytes
    16 heads, 63 sectors/track, 416101 cylinders, total 419430400 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000a608e

    Device Boot Start End Blocks Id System /dev/vda1 * 2048 1026047 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 1026048 41943039 20458496 8e Linux LVM Partition 2 does not end on cylinder boundary.

现在我有点困惑,现在我该如何进行最简单的方法是什么?


嗨 GioMac 非常感谢您的帮助,下面是所请求的输出。

由于篇幅过长,输出已移至 Pastebin

在 serverfault 上发布请求之前,我联系了服务器提供商,他们向我提供了本指南(http://guide.onamae-server.com/vpskvm/1_15_16_81_1/) 由于服务器是 KVM,他们不提供支持,所以他们无法告诉我更多相关信息。

 lsblk
NAME                              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                                11:0    1 1024M  0 rom
vda                               252:0    0  200G  0 disk
ââvda1                            252:1    0  500M  0 part /boot
ââvda2                            252:2    0 19.5G  0 part
  ââvg_v1577145116-lv_root (dm-0) 253:0    0 15.6G  0 lvm  /
  ââvg_v1577145116-lv_swap (dm-1) 253:1    0    4G  0 lvm  [SWAP]

 partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/vda (              Device or resource busy).  As a result, it may not reflect all of your changes u              ntil after reboot.

答案1

我没有看到文件系统已满。但是没关系。

好消息是您正在使用 LVM,因此,您可以轻松扩展和移动任何内容。

有两种方法可以扩展您的空间:

A. 提供扩展的vda

您必须扩展 LVM 物理卷、卷组,将其添加到逻辑卷,然后扩展 linux 文件系统

B. 提供商附加新磁盘,(如 vdb)

您必须创建 LVM pv,将其添加到 vg,为 lv 添加空间,然后扩展 linux 文件系统

两者都可以在实时系统上完成。

如果您正在运行图形服务器,您可以执行 system-config-lvm GUI。

为了获得完整的答案,请提供更多详细信息,例如:

partprobe
df -h
fdisk -l
dmesg
pvs
vgs
lvs
mount

并告诉您从哪个操作系统连接到服务器。

答案2

我没有注意到新分区的文件系统。你应该使用“mount”命令。请检查与此命令相关的文档 [1]。Mount 命令将挂载分区,但不会永久挂载。下次启动时,你需要再次挂载它。要使其永久挂载,你应该编辑 /etc/fstab 文件。请参阅 [2] 了解如何以永久方式挂载分区。

问候

[1]http://linux.die.net/man/8/mount
[2]http://linuxexpresso.wordpress.com/2010/03/14/mount-partitions-in-terminal-fstab/

相关内容