1.创建分区
- Command (m for help):
- 这里按m获得帮助
- a toggle a bootable flag 将分区设置为启动区
- b edit bsd disklabel 编辑bsd的disklabel
- c toggle the dos compatibility flag 设置该分区为dos分区
- d delete a partition 删除分区
- l list known partition types 列出已知的分区类型
- m print this menu 打印帮助列表
- n add a new partition 创建新分区
- o create a new empty DOS partition table
- p print the partition table查看分区信息
- q quit without saving changes 退出不保存
- s create a new empty Sun disklabel
- t change a partition's system id改变分区类型
- u change display/entry units
- v verify the partition table
- w write table to disk and exit 保存退出
- x extra functionality (experts only)
- Command (m for help):p //查看新硬盘的分区
- ********************************************************************
- Disk /dev/sdb: 1000204 MB, 1000202273280 bytes
- 255 heads, 63 sectors/track, 121601 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- ********************************************************************
- Command (m for help):n //创建新分区
- File system type (default ext2): ext3 //输入想使用的分区格式
- Partition name: backup //输入分区的名字
- First cylinder (default 0cyl): //第几个柱面,我们按照默认
- Last cylinder or +size or +sizeMB or +sizeKB (default 0cyl):+1000000M //这里我们按大小输入 即+1000000M (注意这个M为大写)
- Warning: You requested a partition from 0cyl to 121576cyl.
- The closest location we can manage is 1cyl to 121575cyl. Is this still
- acceptable to you?
- y Yes
- n No
- 当然是y
- Command (m for help): p //查看新硬盘分区后的情况
- ********************************************************************
- Disk /dev/sdb: 1000 GB, 1000202273280 bytes
- 255 heads, 63 sectors/track, 121601 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- /dev/sdb1 2 121576 976559157 83 Linux
- ******************************************************************
- Command (m for help): w
- Information: Don't forget to update /etc/fstab, if necessary. //写入硬盘分区属性并结束
2.格式化硬盘
3.手动挂载
4.开机自动挂载
<file system> <mount point> <type> <options> <dump> <pass>
/dev/sdb1 /opt/sync/ ext4 defaults 0 0
- Shell 代码
- sudo mount -a #及时生效
5.重启机器查看结果
参考资料:http://blog.csdn.net/chief1985/article/details/4610345