扩充vmware磁盘大小以及分区

扩充vmware磁盘大小以及分区

扩充vmware磁盘大小

分区

目前使用vmware版本为17.5.2

gparted

fdisk

cxq@ubuntu:~$ sudo fdisk -l
Disk /dev/loop0: 219 MiB, 229638144 bytes, 448512 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: 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/loop2: 65.1 MiB, 68259840 bytes, 133320 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/loop3: 50.98 MiB, 53432320 bytes, 104360 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/loop5: 55.37 MiB, 58052608 bytes, 113384 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/loop6: 44.3 MiB, 46448640 bytes, 90720 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/loop7: 4 KiB, 4096 bytes, 8 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: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: VMware Virtual S
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: dos
Disk identifier: 0x6b58acd8

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *       2048  1050623  1048576  512M  b W95 FAT32
/dev/sda2       1052670 41940991 40888322 19.5G  5 Extended
/dev/sda5       1052672 41940991 40888320 19.5G 83 Linux


Disk /dev/loop8: 218.4 MiB, 228999168 bytes, 447264 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/loop9: 91.7 MiB, 96141312 bytes, 187776 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

查看当前分区

cxq@ubuntu:~$ ls /dev/sd* 
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda5

通过gparted软件将扩展的20G分了7.32G给/dev/sda3

通过ls /dev/sd* 可以发现多了刚刚分配的 /dev/sda3

cxq@ubuntu:~$ ls /dev/sd* 
/dev/sda  /dev/sda1  /dev/sda2  /dev/sda3  /dev/sda5

fdisk 将能够打开 /dev/sda3 并允许用户进行分区操作

cxq@ubuntu:~$ sudo fdisk /dev/sda3  
[sudo] password for cxq: 

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x0021fe8e.

Command (m for help): m
Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15351807, default 2048): 2048
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15351807, default 15351807): +5G

Created a new partition 1 of type 'Linux' and of size 5 GiB.

Command (m for help): p

Disk /dev/sda3: 7.33 GiB, 7860125696 bytes, 15351808 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: dos
Disk identifier: 0x0021fe8e

Device      Boot Start      End  Sectors Size Id Type
/dev/sda3p1       2048 10487807 10485760   5G 83 Linux

此时

partprobe 刷新

root@ubuntu:/home/cxq# ll /dev/sd*
brw-rw---- 1 root disk 8, 0 Jan  1 07:12 /dev/sda
brw-rw---- 1 root disk 8, 1 Jan  1 07:12 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jan  1 07:12 /dev/sda2
brw-rw---- 1 root disk 8, 3 Jan  1 07:12 /dev/sda3
brw-rw---- 1 root disk 8, 5 Jan  1 07:12 /dev/sda5
root@ubuntu:/home/cxq# partprobe /dev/sda3 

将/dev/sda3 挂载到根目录上

root@ubuntu:/home/cxq# mount /dev/sda3   / 

用于显示文件系统的磁盘空间使用情况

cxq@ubuntu:~$ df -h 
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           388M  1.8M  386M   1% /run
/dev/sda5        20G  6.9G   12G  38% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0      128K  128K     0 100% /snap/bare/5
/dev/loop1       56M   56M     0 100% /snap/core18/2128
/dev/loop2      219M  219M     0 100% /snap/gnome-3-34-1804/93
/dev/loop3       56M   56M     0 100% /snap/core18/2846
/dev/loop4      219M  219M     0 100% /snap/gnome-3-34-1804/72
/dev/loop5       66M   66M     0 100% /snap/gtk-common-themes/1515
/dev/loop6       92M   92M     0 100% /snap/gtk-common-themes/1535
/dev/loop7       51M   51M     0 100% /snap/snap-store/547
/dev/loop8       45M   45M     0 100% /snap/snapd/23258
/dev/sda1       511M  4.0K  511M   1% /boot/efi
tmpfs           388M   20K  388M   1% /run/user/1000
相关推荐
qw9491 小时前
MySQL 08 章——聚合函数
数据库·mysql
开心工作室_kaic2 小时前
springboot548二手物品交易boot代码(论文+源码)_kaic
前端·数据库·vue.js·后端·html5
尘浮生5 小时前
Java项目实战II基于微信小程序的家庭大厨(开发文档+数据库+源码)
java·开发语言·数据库·微信小程序·小程序·maven
m0_634601666 小时前
2025.1.2
java·服务器·数据库
张乔249 小时前
spring boot项目启动时自定义logo
java·数据库·spring boot
xiaobai12 39 小时前
MySQL图形化界面工具--DataGrip
数据库·mysql
freejackman9 小时前
Redis快速入门
数据库·redis·缓存
雪碧透心凉_10 小时前
Win32汇编学习笔记03.RadAsm和补丁
linux·服务器·数据库
代码欢乐豆10 小时前
NoSQL——期末复习(3)第三章MongoDB重点思考题
数据库·mongodb·nosql
PyAIGCMaster10 小时前
局网设置mongodb服务的方法。
数据库·mongodb