1. ssh登錄云主機(jī),查看磁盤狀況
[root@MyCloudServer ~]# fdisk -l
Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000858c5
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 64 1306 9972736 8e Linux LVM
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
從查詢結(jié)果看出,一般我們需要掛載的是/dev/xvdb的盤
2. 用fdisk 對/dev/xvdb 進(jìn)行分區(qū)
[root@MyCloudServer ~]# fdisk /dev/xvdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 2610):
Using default value 2610
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
再次查看分區(qū)情況,多出來一個/dev/xvdb1 的區(qū),這個1是我們在前面指定的,如果我們指定2,就變成 xvdb2了。
[root@MyCloudServer ~]# fdisk -l
Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000858c5
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 64 1306 9972736 8e Linux LVM
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280
bytesSector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/xvdb1 1 652 5237158+ 83 Linux
[root@MyCloudServer ~]#
3. 格式化 /dev/xvdb1 分區(qū)
[root@MyCloudServer ~]# mkfs -t ext3 /dev/xvdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
655360 inodes, 1309289 blocks
65464 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4. 在根目錄下創(chuàng)建目錄 并將 /dev/sdb1 掛在到該目錄下
[root@MyCloudServer ~]# cd /
[root@MyCloudServer ~]# mkdir /data
[root@MyCloudServer ~]# ls
bin boot data dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var
[root@MyCloudServer ~]# mount /dev/xvdb1 /data
5. 驗證掛載是否成功
[root@MyCloudServer ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 9131772 7066884 1601012 82% /
none 454256 0 454256 0% /dev/shm
/dev/xvdb1 5154852 43040 4849956 1% /data
6. 設(shè)置開機(jī)自動掛載
[root@MyCloudServer ~]# vi /etc/fstab
在文本最下面添加
/dev/xvdb1 /data ext3 defaults 0 0
然后保存退出。