原文链接:http://blog.sina.com.cn/s/blog_97688f8e0102uwtz.html
1、查看下当前文件系统
[root@VM_28_226_centos ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 8254240 1099340 6735608 15% /
只有一个/dev/vda1挂在了根下边,也就是系统软件装在这里
2、查看下当前硬盘情况
[root@VM_28_226_centos ~]# fdisk -l
Disk /dev/vda: 8589 MB, 8589901824 bytes
255 heads, 63 sectors/track, 1044 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: 0xcd6e8236
Device Boot Start End Blocks Id System
/dev/vda1 * 1 1044 8385898+ 83 Linux
Disk /dev/vdb: 268.4 GB, 268435456000 bytes
16 heads, 63 sectors/track, 520126 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/vdb doesn't contain a valid partition table
Disk /dev/vdc: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/vdc doesn't contain a valid partition table
看到一个盘,/dev/vdb,270G。现在格式化下。
3、格式化
[root@VM_28_226_centos ~]# mkfs -t ext3 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
16384000 inodes, 65536000 blocks
3276800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2000 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, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
-t 是指分区类型 这里用ext3
4、把磁盘挂载到/data
mount /dev/vdb /data
[root@VM_28_226_centos ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 8254240 1099384 6735564 15% /
/dev/vdb 258030980 191708 244732072 1% /data
5、设置开机自动挂载
vim /etc/fstab
添加一条
/dev/vdb /data ext3 noatime,acl,user_xattr 1 0
(fstab的文件格式,以后记录)