在我的 240 GB SSD 上,我最初有两个分区,一个包含 Linux Mint 的逻辑卷,另一个包含与 Windows 共享的 NTFS 分区。
现在我删除了 NTFS 分区并希望扩展我的逻辑卷组以使用释放的磁盘空间。
如何扩展卷组、包含 /home 的逻辑卷和/home 上的文件系统 (ext4)?这可以在网上做吗?
PS:是的,我知道我必须备份我的数据:)
/dev/sdb/ (240GB)
linuxvg (160GB) should use 100% of the disk space
swap
root
home (ext4, 128GB) should be extended to use the remaining space
Run Code Online (Sandbox Code Playgroud)
的输出sudo vgdisplay:
--- Volume group ---
VG Name linuxvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 160,00 GiB
PE Size 4,00 MiB
Total PE 40959
Alloc PE / Size 40959 / 160,00 GiB
Free PE / Size 0 / 0
VG UUID ...
--- Logical volume ---
LV Path /dev/linuxvg/swap
LV Name swap
VG Name linuxvg
LV UUID ...
LV Write Access read/write
LV Creation host, time mint, 2013-08-06 22:48:32 +0200
LV Status available
# open 2
LV Size 8,00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/linuxvg/root
LV Name root
VG Name linuxvg
LV UUID ...
LV Write Access read/write
LV Creation host, time mint, 2013-08-06 22:48:43 +0200
LV Status available
# open 1
LV Size 24,00 GiB
Current LE 6144
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
--- Logical volume ---
LV Path /dev/linuxvg/home
LV Name home
VG Name linuxvg
LV UUID ...
LV Write Access read/write
LV Creation host, time mint, 2013-08-06 22:48:57 +0200
LV Status available
# open 1
LV Size 128,00 GiB
Current LE 32767
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Physical volumes ---
PV Name /dev/sdb1
PV UUID ...
PV Status allocatable
Total PE / Free PE 40959 / 0
Run Code Online (Sandbox Code Playgroud)
的输出sudo fdisk -l:
Disk /dev/sdb: 240.1 GB, 240057409536 bytes
255 heads, 63 sectors/track, 29185 cylinders, total 468862128 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
Device Boot Start End Blocks Id System
/dev/sdb1 1 468862127 234431063+ ee GPT
Disk /dev/mapper/linuxvg-swap: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 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/linuxvg-root: 25.8 GB, 25769803776 bytes
255 heads, 63 sectors/track, 3133 cylinders, total 50331648 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/linuxvg-home: 137.4 GB, 137434759168 bytes
255 heads, 63 sectors/track, 16708 cylinders, total 268427264 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
Run Code Online (Sandbox Code Playgroud)
phe*_*mer 60
你可以相当简单地做到这一点。有点惊讶这里已经没有答案了。
您可以在要调整大小的文件系统上运行时完成整个过程(是的,它是安全且完全受支持的)。不需要急救 CD 或备用操作系统。
fdisk. 但是您必须删除分区并重新创建它。只需确保这样做时新分区从完全相同的位置开始。pvresize /dev/sdXY让 LVM 获取新空间。lvextend。如果你想使用整个东西,lvextend -r -l +100%FREE /dev/VGNAME/LVNAME. 在-r将调整文件系统也是如此。MGP*_*MGP 17
没有一个答案能公正地评价 LVM 的力量。
(这是基于@frostchutz 对上述问题的评论。)
让我们来了解一下事实:
home内的逻辑卷linuxvg。LVM 步骤使用“务实的方式”:
pvcreate /dev/sdb1linuxvg:vgextend linuxvg /dev/sdb1home使用所有可用空间扩展逻辑卷(并调整文件系统大小):lvextend -r -l +100%FREE /dev/linuxvg/homeLVM 允许很大程度的间接性。逻辑卷位于一个卷组内,该卷组可能使用多个磁盘。
主页 --> linuxvg --> (sdb1, sdb2, sdc1)
http://tldp.org/HOWTO/LVM-HOWTO/createvgs.html
kli*_*net 12
阅读此博客文章后,问题已解决。我将以简短的形式编写解决方案:
gdisk(如果您使用 GPT)否则您可以使用旧的fdiskgdisk -l /dev/sdbpartprobe -s以刷新分区表而无需重新启动pvresize /dev/sdb1在 pv 所在的位置或任何位置调整物理卷的大小(用于pvs确定您是否不知道)lvextend -l +100%FREE /dev/file/of/your/lv,在我的情况下sudo lvextend -l +100%FREE /dev/linuxvg/homesudo resize2fs /dev/linuxvg/homesudo e2fsck -f /dev/linuxvg/home