Linux 磁盘挂载
以Centon OS 挂载为例
查看硬盘空间
$ fdisk -l
Disk /dev/vda: 105.2 GB, 105226698752 bytes, 205520896 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: 0x000ae693
磁盘分区
$ fdisk -S 56 /dev/vda
# 依次输入“n”,“p”,“1”,两次回车,“wq”,分区就开始了,很快就会完成
# 1 的值需要看情况具体输入值
$ fdisk -l
# 查看新分的磁盘信息
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 1230847 614400 83 Linux
/dev/vda2 1230848 104843263 51806208 8e Linux LVM
/dev/vda3 104843264 205520895 50338816 83 Linux
格式化新磁盘
$ mkfs.ext3 /dev/vda3
# 出现如下信息时,使用 partprobe 解决
mke2fs 1.42.9 (28-Dec-2013)
Could not stat /dev/vda3 --- No such file or directory
The device apparently does not exist; did you specify it correctly?
重新格式格式化即可成功
写入新分区信息
# /data-mount 需要挂载的目录 vda3 需要挂载的分区
$ echo '/dev/vda3 /data-mount ext3 defaults 0 0' >> /etc/fstab
# 写入之后,使用 cat /etc/fstab 查看,出现刚才写入的信息即写入完成
挂载磁盘
# 使用命令挂载,使用 df -hl 查看挂载分区
$ mount -a