首页 > 系统相关 >VMware之Ubuntu20.04拓展根目录磁盘空间

VMware之Ubuntu20.04拓展根目录磁盘空间

时间:2024-04-26 15:15:19浏览次数:28  
标签:Ubuntu20.04 cl bytes E6% dev 根目录 512 VMware size

1、改变虚拟磁盘大小

  • 关闭Ubuntu
  • 右键—>设置—>硬盘—->实用工具—>扩展
  • 填入扩展后的分区大小
  • 确定

2、查看磁盘使用情况

  • 开启Ubuntu

  • 输入:df -h

cl@cl:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            955M     0  955M   0% /dev
tmpfs           198M  1.3M  196M   1% /run
/dev/sda2        30G   14G   15G  48% /
tmpfs           986M     0  986M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           986M     0  986M   0% /sys/fs/cgroup
/dev/loop0       98M   98M     0 100% /snap/core/10185
/dev/loop1      205M  205M     0 100% /snap/microk8s/1710
/dev/loop2       98M   98M     0 100% /snap/core/10126
/dev/loop3      205M  205M     0 100% /snap/microk8s/1769
tmpfs           198M     0  198M   0% /run/user/1000

3、在Ubuntu shell进行分区扩容操作

cl@cl:~$ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
  • 打印查看分区划分情况
Command (m for help): p
Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 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: BB1002CF-D749-4A1F-8DF7-EF0945D4DF0E

Device     Start      End  Sectors Size Type
/dev/sda1   2048     4095     2048   1M BIOS boot
/dev/sda2   4096 83886046 83881951  40G Linux filesystem
  • 删除需要扩容的分区,这里是2,完成后不要执行 w 写入
Command (m for help): d
Partition number (1,2, default 2): 2


Command (m for help): p
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 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: 0976B291-839E-463D-BD05-936253587234

Device     Start   End Sectors Size Type
/dev/sda1   2048  4095    2048   1M BIOS boot
  • 创建新分区
# 创建新分区 ,First和Last sector直接回车默认值,因为我是把剩下所有空闲的空间全部分配到扩容的新分区内
# 若是部分分配,请在Last sector输入对应的值
Command (m for help): n
Partition number (2-128, default 2):
First sector (4096-209715166, default 4096):
Last sector, +sectors or +size{K,M,G,T,P} (4096-209715166, default 209715166):

Created a new partition 2 of type 'Linux filesystem' and of size 100 GiB.
Partition '#2' contains a ext4 signature.

# No
Do you want to remove the signature? [Y]es/[N]o: n
  • 查看新分区
Command (m for help): p

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 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: 0976B291-839E-463D-BD05-936253587234

Device     Start       End   Sectors  Size Type
/dev/sda1   2048      4095      2048    1M BIOS boot
/dev/sda2   4096 209715166 209711071  100G Linux filesystem
  • 确认无误后 w 写入操作
Command (m for help): w

The partition table has been altered.
Syncing disks.
  • 重启机器
cl@cl:~$ sudo reboot

4、执行扩容操作

# 执行扩容操作
root@cl:~# pvs

root@cl:~# pvresize /dev/sda2          //扩展物理分区

root@cl:~# lvdisplay

root@cl:~# lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv     

5、参考文档
https://blog.csdn.net/qq32048487/article/details/136944155
https://kleinlsl.github.io/2020/11/13/VM%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%BB%99Ubuntu%E6%A0%B9%E5%88%86%E5%8C%BA%E6%89%A9%E5%AE%B9/#4%E3%80%81%E6%89%A7%E8%A1%8C%E6%89%A9%E5%AE%B9%E6%93%8D%E4%BD%9C

标签:Ubuntu20.04,cl,bytes,E6%,dev,根目录,512,VMware,size
From: https://www.cnblogs.com/alicute/p/18160114

相关文章

  • Ubuntu 24.04 LTS x86_64 OVF (sysin) - VMware 虚拟机模板
    Ubuntu24.04LTSx86_64OVF(sysin)-VMware虚拟机模板Ubuntu24.04LTS(GNU/Linux6.8-genericx86_64)请访问原文链接:Ubuntu24.04LTSx86_64OVF(sysin)-VMware虚拟机模板,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org无耻抄袭者YuTao请远离本站!!!......
  • Linux:VMware切换"仅主机模式"并配置静态IP
    配置网络编辑器点击“编辑”->“虚拟网络编辑器”没有仅主机模式的话,可以通过“添加网络”进行新增网络配置。更改虚拟机网路模式右键“创建的虚拟就”->“设置”登录虚拟机配置静态IP切换目录到“/etc/sysconfig/network-scripts/”修改“if-ens33”文件TYPE=Ethern......
  • linux centos8 系统扩容 VMware Centos---VMware ESXi
    linux系统扩容VMwareCentos---VMwareESXi用到的命令df fdisk  pvcreate  pvdisplay   vgdisplay   vgextend   lvdisplay   lvextend  resize2fs01)使用了一段时间虚拟机后发现磁盘不够用了,需要扩容。在客户端操作扩容出现磁盘已成功扩展。......
  • 安装虚拟机VMware,然后再安装ubuntu系统
      1.虚拟机vmware和unbuntu安装 1.1Vmware官方下载地址:https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.htmlvmware版本并不是越新越好,我下载的是VMwareWorkstation64位_17.0.0.34456。其对应激活秘钥:https://www.haozhuangji.com/xtj......
  • 【VMware by Broadcom】产品版本和内部版本号
    VMwareESXi/ESXBuildnumbersandversionsofVMwareESXi/ESX(2143832)VMwarevCenterServerBuildnumbersandversionsofVMwarevCenterServer(2143838)VMwarevCenterChargebackBuildnumbersandversionsofVMwarevCenterChargeback (2143841)V......
  • Windows Server 2008 R2 OVF, updated Apr 2024 (sysin) - VMware 虚拟机模板
    WindowsServer2008R2OVF,updatedApr2024(sysin)-VMware虚拟机模板WindowsServer2008R2简体中文版OVF,2024年4月更新请访问原文链接:WindowsServer2008R2OVF,updatedApr2024(sysin)-VMware虚拟机模板,查看最新版。原创作品,转载请保留出处。作者主......
  • Windows Server 2022 OVF, updated Apr 2024 (sysin) - VMware 虚拟机模板
    WindowsServer2022OVF,updatedApr2024(sysin)-VMware虚拟机模板2024年4月版本更新,现在自动运行sysprep,支持ESXiHostClient部署请访问原文链接:WindowsServer2022OVF,updatedApr2024(sysin)-VMware虚拟机模板,查看最新版。原创作品,转载请保留出处。作......
  • Windows Server 2019 OVF, updated Apr 2024 (sysin) - VMware 虚拟机模板
    WindowsServer2019OVF,updatedApr2024(sysin)-VMware虚拟机模板2024年4月版本更新,现在自动运行sysprep,支持ESXiHostClient部署请访问原文链接:WindowsShttps://sysin.org/blog/windows-server-2019-ovf/erver2019OVF,updatedApr2024(sysin)-VMware虚......
  • Windows Server 2016 OVF, updated Apr 2024 (sysin) - VMware 虚拟机模板
    WindowsServer2016OVF,updatedApr2024(sysin)-VMware虚拟机模板2024年4月版本更新,现在自动运行sysprep,支持ESXiHostClient部署请访问原文链接:WindowsServer2016OVF,updatedApr2024(sysin)-VMware虚拟机模板,查看最新版。原创作品,转载请保留出处。作......
  • Ubuntu20.04 安装Terminator
    在ROS中,需要频繁的使用到终端,且可能需要同时开启多个窗口,推荐一款较为好用的终端:Terminator。效果如下:1.安装sudoaptinstallterminator2.添加到收藏夹显示应用程序--->搜索terminator--->右击选择添加到收藏夹3.Terminator常用快捷键第一部份:关于在同一个标......