1、查看已挂载磁盘情况
df -vh
可以看到
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.9G 36G 5% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 328K 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 1.6G 0 1.6G 0% /run/user/1000
2、查看所有磁盘情况
fdisk -l
可以看到
Disk /dev/vda: 42.9 GB, 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
Disk label type: dos
Disk identifier: 0x0008de3e
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83884031 41940992 83 Linux
Disk /dev/vdb: 536.9 GB, 536870912000 bytes, 1048576000 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
3、 格式化磁盘(这里挂载磁盘名为vdb)
mkfs.ext4 /dev/vdb
4、挂在分区到磁盘mnt目录下,并设置为开机生效
echo "/dev/vdb /mnt ext4 defaults 0 0" >> /etc/fstab
mount -a
5、重启机器
reboot
6.解除挂载
umount /dev/vdb