虚拟机添加硬盘自动挂载
fdisk -l /dev/sdb
Command (m for help): m
Command (m for help): p
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):2610
Command (m for help): p
Command (m for help): w
fdisk -l /dev/sdb
效果:
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux
使用 mkfs.ext4 命令格式化磁盘成格式化成ext4各式的文件系统。
mkfs.ext4 /dev/sdb1
系统启动时自动挂载server
mount /dev/sdb1 /server/
echo "/dev/sdb1 /server ext4 defaults 0 0" >> /etc/fstab
df -h 查看是否添加上