Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。












想要改善这个问题吗?更新问题,以便将其作为on-topic用于堆栈溢出。

5年前关闭。



Improve this question




我有以下问题。我已经在我的ubuntu机器上添加了20GB(从20GB到40GB)。现在这就是我从fdisk -l命令获得的信息:
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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: 0x000881a0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    41940991    20719617    5  Extended
/dev/sda5          501760    41940991    20719616   8e  Linux LVM

Disk /dev/mapper/zabbix-root: 20.1 GB, 20124270592 bytes
255 heads, 63 sectors/track, 2446 cylinders, total 39305216 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: 0x00000000

Disk /dev/mapper/zabbix-root doesn't contain a valid partition table

Disk /dev/mapper/zabbix-swap_1: 1069 MB, 1069547520 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2088960 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: 0x00000000
我试图用以下命令扩展它:
lvextend -L+20G /dev/mapper/zabbix-root
我得到了关注
Extending logical volume root to 38.74 GiB
Insufficient free space: 5120 extents needed, but only 5 available
有人可以帮忙做什么,以增加20gb扩展我的根吗?
谢谢
更新
好吧,我先用cfdisk,pvcreate和vgextend弥补了,再用lvextend弥补了,现在我可以用vgdisplay命令在我的卷组中看到40gb了。
下一个问题是。如何也刷新df等命令的信息?使用df -h时,这里仍然只有19gb ...生病了我从lvdisplay,vgdisplay,fdisk -l和df -h的输出。
fdisk -l:
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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: 0x000881a0

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    83886079    41692161    5  Extended
/dev/sda5          501760    41940991    20719616   8e  Linux LVM
/dev/sda6        41941055    83886079    20972512+  83  Linux

Disk /dev/mapper/zabbix-root: 41.6 GB, 41599107072 bytes
255 heads, 63 sectors/track, 5057 cylinders, total 81248256 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: 0x00000000

Disk /dev/mapper/zabbix-root doesn't contain a valid partition table

Disk /dev/mapper/zabbix-swap_1: 1069 MB, 1069547520 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2088960 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: 0x00000000

Disk /dev/mapper/zabbix-swap_1 doesn't contain a valid partition table
df -h:
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/zabbix-root   19G   17G  791M  96% /
udev                     489M  8.0K  489M   1% /dev
tmpfs                    200M  280K  199M   1% /run
none                     5.0M     0  5.0M   0% /run/lock
none                     498M     0  498M   0% /run/shm
/dev/sda1                228M   25M  192M  12% /boot
vgdisplay:
--- Volume group ---
VG Name               zabbix
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               39.76 GiB
PE Size               4.00 MiB
Total PE              10178
Alloc PE / Size       10173 / 39.74 GiB
Free  PE / Size       5 / 20.00 MiB
VG UUID               d4I8HJ-Rq2h-CPf1-LKFm-Bsam-3Mqe-9e39F3
lvdisplay:
--- Logical volume ---
LV Name                /dev/zabbix/root
VG Name                zabbix
LV UUID                N4NqWB-P6Hr-L51A-q98I-oAE9-qmvu-wHjQxo
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                38.74 GiB
Current LE             9918
Segments               3
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:0

--- Logical volume ---
LV Name                /dev/zabbix/swap_1
VG Name                zabbix
LV UUID                jDDTkD-VpZf-BXng-rQDI-HKSc-I8j2-mOY47c
LV Write Access        read/write
LV Status              available
# open                 2
LV Size                1020.00 MiB
Current LE             255
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:1
pvdisplay:
--- Physical volume ---
PV Name               /dev/sda5
VG Name               zabbix
PV Size               19.76 GiB / not usable 2.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              5058
Free PE               0
Allocated PE          5058
PV UUID               g2jnVt-dFQ6-takf-qz8L-QFf4-VAEQ-QYvp3u

--- Physical volume ---
PV Name               /dev/sda6
VG Name               zabbix
PV Size               20.00 GiB / not usable 992.50 KiB
Allocatable           yes
PE Size               4.00 MiB
Total PE              5120
Free PE               5
Allocated PE          5115
PV UUID               Il7KFu-rCa9-3sUE-0Hrz-qtyX-s8eL-eLpOGR

最佳答案

所以我想通了。首先,我需要在vmware环境中扩大磁盘大小。之后,我需要使用以下内容重新扫描我的ubuntu服务器:

echo "- - -" > /sys/class/scsi_host/host#/scan

其中#我必须用scsi_host中的每个主机的数字替换。然后,我可以使用以下命令在ubuntu中看到增加的空间:
fdisk -l

在下一步中,我必须使用此命令来准备或格式化该自由空间:
cfdisk /dev/sda

-您可以根据自己的意愿格式化(也可以空格)
现在有一个新分区。 -就我而言:/dev/sda6

下一步是对新分区使用pvcreate:
pvcreate /dev/sda6

完成此操作后,只需使用以下命令将其添加到现有卷组中:
vgextend vg_name /dev/sda6

现在我们终于可以使用以下命令扩展我的逻辑卷:
lvextend -L+20G /dev/zabbix/root

如果现在检查fdisk -l,则存在/zabbix-root,其中+ 20GB :)
芽别忘了使用resize2fs让文件系统知道有一些变化。如果您不这样做,那么您将无法使用新的空间。
resize2fs /dev/zabbix/root

10-08 11:57