- 检查下你的磁盘是否已经挂载上
[root@VM_77_2_centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 1.9G 17G 10% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 24K 1.9G 1% /dev/shm
tmpfs 1.9G 13M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
- 查看你机器上的所有磁盘
[root@VM_77_2_centos ~]# 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: 0x000c47d9
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 41943039 20970496 83 Linux
Disk /dev/vdb: 64.4 GB, 64424509440 bytes, 125829120 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没有格式化
- 格式化/dev/vdb
[root@VM_77_2_centos ~]# mkfs.ext3 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3932160 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
- 挂载磁盘
将磁盘挂载在路径 /data/d1
[root@VM_77_2_centos ~]# mkdir /data/d1 -p
[root@VM_77_2_centos ~]# ls /data
d1
[root@VM_77_2_centos ~]# mount /dev/vdb /data/d1
[root@VM_77_2_centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 1.9G 17G 10% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 24K 1.9G 1% /dev/shm
tmpfs 1.9G 13M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/vdb 59G 52M 56G 1% /data/d1
- 设置自动挂载
先备份下文件 /etc/fstab, 然后修改/etc/fstab,将先的磁盘信息加上
[root@VM_77_2_centos ~]# cp /etc/fstab /etc/fstab.bk
[root@VM_77_2_centos ~]# vim /etc/fstab
将新的磁盘信息追加上
/dev/vda1 / ext3 noatime,acl,user_xattr 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/vdb /data/d1 ext3 defaults 0 2