扩充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
相关推荐
workflower2 小时前
MDSE和敏捷开发相互矛盾之处:方法论本质的冲突
数据库·软件工程·敏捷流程·极限编程
Tony小周2 小时前
实现一个点击输入框可以弹出的数字软键盘控件 qt 5.12
开发语言·数据库·qt
lifallen2 小时前
Paimon 原子提交实现
java·大数据·数据结构·数据库·后端·算法
TDengine (老段)3 小时前
TDengine 数据库建模最佳实践
大数据·数据库·物联网·时序数据库·tdengine·涛思数据
Elastic 中国社区官方博客3 小时前
Elasticsearch 字符串包含子字符串:高级查询技巧
大数据·数据库·elasticsearch·搜索引擎·全文检索·lucene
Gauss松鼠会3 小时前
GaussDB应用场景全景解析:从金融核心到物联网的分布式数据库实践
数据库·分布式·物联网·金融·database·gaussdb
守城小轩4 小时前
Chromium 136 编译指南 - Android 篇:开发工具安装(三)
android·数据库·redis
尽兴-4 小时前
如何将多个.sql文件合并成一个:Windows和Linux/Mac详细指南
linux·数据库·windows·sql·macos
小小不董4 小时前
深入理解oracle ADG和RAC
linux·服务器·数据库·oracle·dba
胚芽鞘6815 小时前
查询依赖冲突工具maven Helper
java·数据库·maven