在具有两个磁盘的 PC 中,我刚刚在其中一个磁盘上安装了 Ubuntu 18.04.02 服务器版。
marco@pc:$ sudo pvdisplay
-- Physical volume ---
PV Name /dev/sda3
VG Name ubuntu-vg
PV Size 231.38 GiB / not usable
Allocatable yes
PE Size 4.00 MiB
Total PE 59234
Free PE 58210
Allocated PE 1024
PV UUID zJfww8-S8hN-iqio-TO88-USuG-IEJF-06in3H
marco@pc:$ sudo fdisk -l
Disk /dev/loop0: 91 MiB, 95308128 bytes, 186344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/I size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 byte
Disklabel type: gpt
Disk identifier: EE7F5194-52B9-4FFc-A272-30021FAC12C3
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 3147775 2097152 1G Linux filesystem
/dev/sda3 3147776 488394751 485246976 231.4G Linux filesystem
Disk /dev/sdb: 232.9 GiB, 250059250016 bytes, 488397168 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
Disklabel type: gpt
Disk identifier:DF99B63F-9A69-46EC-9BA8-47FD4CE8213C
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 488394751 487344128 232.4G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 4 GiB, 4294967296 bytes, 8388608
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
我想将系统扩展到第二个SSD:
marco@pc:$ sudo vgextend ubuntu_vg /dev/sdb
Device /dev/sdb excluded by a filter
尝试将系统扩展到第二个磁盘的一个分区:
marco@pc:$ sudo vgextend ubuntu_vg /dev/sdb1
Can't open /dev/sdb1 exclusively. Mounted filesystem?
在 /etc/lvm/lvm.conf 中我没有找到任何未注释的 filter = 或 global filter = 行。
如何禁用这个我在 Ubuntu 18.04.02 服务器版安装过程中没有插入的“过滤器”?期待您的帮助。Marco
我通过以下方式解决了这个问题:
在一个磁盘上重新安装 Ubuntu 18.04.02 服务器版后,为了保持干净的状态,我执行了以下步骤:
1)将第二个磁盘标记为“lvm”磁盘:
marco@pc:$ sudo pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
2)将卷组扩展到第二个磁盘:
marco@pc:$ sudo vgextend pc-vg /dev/sdb
Volume group "pc-vg" successfully extended
3)扩大尺寸:
sudo lvextend /dev/mapper/pc--vg-root -L +240G
4)相应地调整文件系统的大小:
sudo resize2fs /dev/mapper/pc--vg-root