芸科技_付费阅读_技术方案_企业源码_商业源码_资源素材
2023-07-25 15:04:16

ubuntu2204lts扩大ubuntu--vg-ubuntu--lv空间

导航摘要

如何扩大ubuntu的ubuntu--vg-ubuntu--lv空间

扩大ubuntu的ubuntu–vg-ubuntu–lv空间

1 查看根分区空间:

root@jack:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               948M     0  948M   0% /dev
tmpfs                              199M  1.1M  198M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  9.8G  4.2G  5.1G  45% /
tmpfs                              992M     0  992M   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              992M     0  992M   0% /sys/fs/cgroup
/dev/loop0                          62M   62M     0 100% /snap/core20/1328
/dev/loop1                          68M   68M     0 100% /snap/lxd/21835
/dev/sda2                          1.5G  110M  1.3G   8% /boot
/dev/loop2                          44M   44M     0 100% /snap/snapd/14978
tmpfs                              199M     0  199M   0% /run/user/0
root@jack:~# 

2 查看磁盘分区列表:

root@jack:~# fdisk -l
Disk /dev/loop0: 61.93 MiB, 64917504 bytes, 126792 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 /dev/loop1: 67.25 MiB, 70508544 bytes, 137712 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 /dev/loop2: 43.6 MiB, 45703168 bytes, 89264 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 /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: VBOX HARDDISK   
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: 58535BBF-9B80-4893-8549-607CF682F850

Device       Start      End  Sectors  Size Type
/dev/sda1     2048     4095     2048    1M BIOS boot
/dev/sda2     4096  3149823  3145728  1.5G Linux filesystem
/dev/sda3  3149824 41940991 38791168 18.5G Linux filesystem

Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 10 GiB, 10737418240 bytes, 20971520 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
root@jack:~# 

3 增加根分区:

lvextend -L 20G /dev/mapper/ubuntu--vg-ubuntu--lv //增大或减小至20G
lvextend -L +20G /dev/mapper/ubuntu--vg-ubuntu--lv //增加20G
lvreduce -L -20G /dev/mapper/ubuntu--vg-ubuntu--lv //减小20G
lvresize -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv //按百分比扩容

resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv //执行调整
root@jack:~# lvextend -L 18.5G /dev/ubuntu-vg/ubuntu-lv 
  Insufficient free space: 10 extents needed, but only 9 available
root@jack:~# 
root@jack:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv 
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 3
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 4848640 (4k) blocks long.

root@jack:~# 

4 查看lvm卷组的信息

扫码免登录支付
本文章为付费文章,是否支付12元后完整阅读?

如果您已购买过该文章,[登录帐号]后即可查看



温馨提示:

1、本内容转载于网络,版权归原作者所有!
2、本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
3、本内容若侵犯到你的版权利益,请联系我们,会尽快给予删除处理!
上一篇:ubuntu2204lts系统基础优化命令
下一篇:ESXI 7.0.2 Intel 核心显卡直通开启3D加速