[root@69-49-234-107 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 4.0K 920M 1% /dev/shm
tmpfs 920M 97M 823M 11% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 20G 19G 1.4G 94% /
/dev/loop0 582M 564K 551M 1% /tmp
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb 9.8G 37M 9.2G 1% /mnt/vol-us-1
先检查系统中有哪些磁盘
[root@69-49-234-107 ~]# fdisk -l
Disk /dev/vda: 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
Disk label type: dos
Disk identifier: 0x000ea36b
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 41943006 20970479+ 83 Linux
Disk /dev/loop0: 636 MB, 636485632 bytes, 1243136 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 /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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
先格式化新的需要挂载的/dev/vdb磁盘
[root@69-49-234-107 ~]# mkfs.ext4 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/vdb is mounted; will not make a filesystem here!
创建挂载目录
[root@69-49-234-107 /]# mkdir home2
[root@69-49-234-107 /]# ls
1 2 backup bin boot dev etc home home2 lib lib64 media mnt opt proc razor-agent.log root run sbin scripts srv sys tmp usr var
[root@69-49-234-107 /]# cd
挂载
[root@69-49-234-107 ~]# mount /dev/vdb /home2
[root@69-49-234-107 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 4.0K 920M 1% /dev/shm
tmpfs 920M 97M 823M 11% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 20G 19G 1.4G 94% /
/dev/loop0 582M 564K 551M 1% /tmp
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb 9.8G 37M 9.2G 1% /home2
查询新的vdb 磁盘的UUID
[root@69-49-234-107 ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
vda
└─vda1 xfs 1fcf2679-aa67-4ced-bb9d-f55d7cbbaa93 /
vdb ext4 2e97e03e-eca1-4c86-97bf-fbfdc92c7ad7 /home2
loop0 ext3 92378e76-a3b7-4b39-9ddd-ac1b0843f91d /var/tmp
挂载成功后,服务器重启,挂载就会消失。因此需要将查询到的新磁盘UUID更新到/etc/fstab文件中,使其服务器启动之后自动挂载。
[root@69-49-234-107 ~]# vim /etc/fstab
[root@69-49-234-107 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 4.0K 920M 1% /dev/shm
tmpfs 920M 97M 823M 11% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 20G 19G 1.4G 94% /
/dev/loop0 582M 564K 551M 1% /tmp
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb 9.8G 37M 9.2G 1% /home2
这里是更新后的/etc/fstab内容
[root@69-49-234-107 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Jan 21 05:45:20 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1fcf2679-aa67-4ced-bb9d-f55d7cbbaa93 / xfs defaults,uquota 0 0
/var/swap.img none swap sw 0 0
/usr/tmpDSK /tmp ext3 defaults,noauto 0 0
UUID=2e97e03e-eca1-4c86-97bf-fbfdc92c7ad7 /home2 ext4 defaults,nofail,discard,noatime 1 2
[root@69-49-234-107 ~]#