0
点赞
收藏
分享

微信扫一扫

ubuntu 安装系统后,硬盘没有全部使用,修改命令

gy2006_sw 2022-02-13 阅读 29

ubuntu server 20.04 安装时,使用的lvm-group功能。

步骤:

安装后使用df 命令查看磁盘没有全部利用:

$ df -hl
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              383M  1.5M  381M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   98G  6.3G   87G   7% /
tmpfs                              1.9G     0  1.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0                          56M   56M     0 100% /snap/core18/2128
/dev/loop2                          71M   71M     0 100% /snap/lxd/21029
/dev/loop1                          33M   33M     0 100% /snap/snapd/12704
/dev/sda2                          976M  108M  801M  12% /boot
tmpfs                              383M     0  383M   0% /run/user/1000

使用 fdisk 命令可以看到是500g硬盘

$ sudo fdisk -l
Disk /dev/loop0: 55.45 MiB, 58130432 bytes, 113536 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: 32.3 MiB, 33865728 bytes, 66144 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: 70.32 MiB, 73728000 bytes, 144000 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: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt

设置使用剩余磁盘:

$ sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

重新计算大小

$ sudo 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

此时查看已经修改:

$ df -hl
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              383M  1.5M  381M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  457G  6.4G  432G   2% /
tmpfs                              1.9G     0  1.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0                          56M   56M     0 100% /snap/core18/2128
/dev/loop2                          71M   71M     0 100% /snap/lxd/21029
/dev/loop1                          33M   33M     0 100% /snap/snapd/12704
/dev/sda2                          976M  108M  801M  12% /boot
tmpfs                              383M     0  383M   0% /run/user/1000

参考:

LVM使用管理及逻辑卷磁盘空间扩展_菜鸟日记-CSDN博客

举报

相关推荐

0 条评论