背景:在装QTCreator 软件发现自己的可用磁盘不够用,当初虚拟安装kali系统只给了20G的磁盘容量现在要
1、在虚拟机管理页面中硬盘-->扩展磁盘容量(虚拟机关机的过程中处理)
2、在修改完成后打开虚拟机
1、输入fdisk -l
输入
fdisk -l#查看磁盘分区
回显
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 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: 0x7a32caa9
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 33554431 33552384 16G 83 Linux
/dev/sda2 33556478 41940991 8384514 4G 5 Extended
/dev/sda3 41940992 125829119 83888128 40G 83 Linux
/dev/sda5 33556480 41940991 8384512 4G 82 Linux swap / Solaris
2、输入fdisk /dev/sda
fdisk /dev/sda #选中可操作的磁盘
回显
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
3、输入 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
4、输入 p 查看分区
Command (m for help): p
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 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: 0x7a32caa9
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 33554431 33552384 16G 83 Linux
/dev/sda2 33556478 41940991 8384514 4G 5 Extended
/dev/sda3 41940992 125829119 83888128 40G 83 Linux
/dev/sda5 33556480 41940991 8384512 4G 82 Linux swap / Solaris
Partition table entries are not in disk order.
5、输入n 创建新的选区
如果没有可用空间则会出现以下情况
Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 6
No free sectors available.
6、其他的按照默认回车即可
7、输入w执行上述分区操作
8、创建分区格式
mkfs -t ext4 /dev/sda3 #设置分区格式为ext4
9、挂载
mkdir /home/disk
mount /dev/sda3 /home/disk
10、开机自动挂载
nano /etc/fstab
/dev/sda3 /home/disk ext4 defaults 0 0 #最后一行写
评论