Linux磁盘挂载
终止以下程序:nginx、apache、mysql、php-fpm、ftp
/etc/init.d/nginx stop
/etc/init.d/httpd stop
/etc/init.d/mysqld stop
/etc/init.d/php-fpm stop
/etc/init.d/vsftpd stop
查看磁盘分区
fdisk -l
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x0008d73aDevice Boot Start End Blocks Id System
/dev/vda1 * 2048 104855551 52426752 83 LinuxDisk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 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磁盘分区
fdisk /dev/vdb
格式化磁盘
mkfs.ext4 /dev/vdb
挂载磁盘
mount /dev/vdb /home
查看磁盘空间
df -lh
设置重启服务器后自动挂载
vi /etc/fstab
插入一行/dev/vdb /home ext4 defaults 0 0
取消挂载
umount /dev/vdb
若想直接直接格式化数据盘,也可以使用mkfs.ext4 /dev/vdb 格式化整个数据盘,然后再进行挂载