# Ubuntu 挂载硬盘
查看已添加的硬盘
fdisk -l
假设返回如下,/dev/vdb1
为已添加的硬盘
Disk /dev/vda: 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: dos
Disk identifier: 0x85af8613
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 83884031 83881984 40G 83 Linux
Disk /dev/vdb: 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: dos
Disk identifier: 0x6dd62375
Device Boot Start End Sectors Size Id Type
/dev/vdb1 63 209714399 209714337 100G 83 Linux
将该硬盘挂载到 /mnt/data
中
mkdir /mnt/data
mount /dev/vdb1 /mnt/data
# 开机自动挂载
df -T
查看硬盘分区类型,Type
显示分区类型为 ext4
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/vdb1 ext4 103080816 78961436 18860140 81% /mnt/data
追加到配置文件
echo '/dev/vdb1 /mnt/data ext4 defaults 0 0' >> /etc/fstab
df -h
查看已挂载的硬盘
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 3.0M 795M 1% /run
/dev/vda1 40G 3.5G 34G 10% /
/dev/vdb1 99G 76G 18G 81% /mnt/data