jul*_*anb 5 partitioning lvm gparted
我需要帮助来调整 LV 大小:/dev/mapper/ubuntu--vg-ubuntu--lv
ubuntu安装是一个VM,磁盘已从8GB扩展到11GB。如何调整/扩展 /dev/mapper/ubuntu--vg-ubuntu--lv 卷的大小?
须藤pv显示:
--- Physical volume ---
PV Name /dev/vda3
VG Name ubuntu-vg
PV Size 8.46 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2166
Free PE 503
Allocated PE 1663
PV UUID fhw3L2-RTCL-wu3w-WovP-6pGF-iQjv-tujWKE
Run Code Online (Sandbox Code Playgroud)
须藤VG显示:
--- Volume group ---
VG Name ubuntu-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
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 8.46 GiB
PE Size 4.00 MiB
Total PE 2166
Alloc PE / Size 1663 / <6.50 GiB
Free PE / Size 503 / 1.96 GiB
VG UUID ZTcc3J-A3jZ-olN4-rFGR-h40F-wqFD-c3hmCn
Run Code Online (Sandbox Code Playgroud)
须藤lv显示:
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID Q31Qia-F92v-te0V-P1fH-4SXv-3uB8-4889p0
LV Write Access read/write
LV Creation host, time ubuntu-server, 2021-10-02 09:59:32 +0200
LV Status available
# open 1
LV Size <6.50 GiB
Current LE 1663
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Run Code Online (Sandbox Code Playgroud)
添加了更多信息:
GPT PMBR size mismatch (20971519 != 23068671) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
Disk /dev/vda: 11 GiB, 11811160064 bytes, 23068672 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: 07C77B10-B73C-442D-9F03-A422017A6AE9
Device Start End Sectors Size Type
/dev/vda1 2048 1050623 1048576 512M EFI System
/dev/vda2 1050624 3147775 2097152 1G Linux filesystem
/dev/vda3 3147776 20899839 17752064 8.5G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 6.51 GiB, 6975127552 bytes, 13623296 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
Run Code Online (Sandbox Code Playgroud)
当我尝试时sudo lvextend -l 100%VG ubuntu-vg/ubuntu-lv
我得到:
/etc/lvm/archive/.lvm_outlineserver_26853_1055914493:写入错误失败:设备上没有剩余空间
当我尝试时sudo fdisk -l /dev/mapper/ubuntu--vg-ubuntu--lv
:
磁盘 /dev/mapper/ubuntu--vg-ubuntu--lv:6.51 GiB,6975127552 字节,13623296 个扇区 单位:1 * 512 = 512 字节的扇区 扇区大小(逻辑/物理):512 字节/512 字节 I/O大小(最小/最佳):512 字节/512 字节
最后当我尝试时sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
我得到:
resize2fs 1.45.5 (07-Jan-2020) 文件系统已经有 1702912 (4k) 块长。没事做!
我不太确定到目前为止你做了什么。分区 /dev/vda3 已增加到 8.5 GB(这意味着使用了 10GB 磁盘),但分区 vda3 的末尾 (20899839) 小于“物理”磁盘的末尾 (23068672),请参阅输出的fdisk -l
。也许GPT PMBR size mismatch (20971519 != 23068671)
给出一些提示。
不管怎样,部分 LVM 结构(pv 和 vg)已经反映了新的大小。缺少的是逻辑卷的大小和文件系统的大小。pvdisplay
从和可以看出vgdisplay
,还有 503 个盘区 = 1.96 GiB 仍然可用。
因此,首先将逻辑卷的大小增加到卷组的大小:
sudo lvextend -l 100%VG ubuntu-vg/ubuntu-lv
fdisk -l /dev/mapper/ubuntu--vg-ubuntu--lv
然后应该给你新的大小 ~ 8.5 GB。
现在,将文件系统的大小增加到逻辑卷的大小(我假设 ext4 代表“/”;如果它是不同的文件系统,则必须使用不同的命令!):
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
当内核支持时,这对于已安装的文件系统是可能的,所有最新的内核都应该这样做。
有关详细信息,请参阅man lvextend
和man resize2fs
。或者请帮我弄清楚我的虚拟机的 LVM2 分区上的可用空间发生了什么
归档时间: |
|
查看次数: |
9524 次 |
最近记录: |