通过wmware虚拟机–>设置–>添加40G容量的硬盘。
──(root㉿kali)-[~/桌面] fdisk -l
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
对/dev/sda进行分区
fdisk /dev/sda
使用sudo fdisk /dev/sdb命令(假设新磁盘为/dev/sdb)对磁盘进行分区。
按照提示输入n(新建分区)、p(主分区)、选择分区号(通常是1)、选择起始扇区和结束扇区(或保持默认)以及输入w(保存并退出)。
这里输入n然后全部默认回车
#格式化分区
mke2fs -t ext4 /dev/sda
挂载磁盘
这时我想将10G容量挂载的/root/dir01目录
mount /dev/sda /root/dir01
但是这样只能用一次,即在pc重启后我们的挂载会丢失,这时我们可以设置配置文件
修改配置文件
vim /etc/fstab
格式如下:
UUID= 挂载目录 文件系统格式 永久性 是否备份 是否自检
UUID可通过blkid
获得
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=cc923131-1e8e-48ae-afd0-128a5944eb95 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=9a332f8d-a7a1-4d8c-bf87-eb64b7613f09 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
UUID=385ff86e-49ee-4b3f-ad34-24639486d2f9 /root/dir02 ext4 defaults 0 0