Ubuntu 14.04 LTS 如何挂载硬盘


1.创建分区


Shell代码 
  1. sudo fdisk /dev/sdb  
Shell代码 
  1. Command (m for help):  
  2. 这里按m获得帮助  
  3. a   toggle a bootable flag   将分区设置为启动区  
  4. b   edit bsd disklabel    编辑bsd的disklabel  
  5. c   toggle the dos compatibility flag  设置该分区为dos分区  
  6. d   delete a partition 删除分区  
  7. l   list known partition types  列出已知的分区类型  
  8. m   print this menu  打印帮助列表  
  9. n   add a new partition 创建新分区  
  10. o   create a new empty DOS partition table  
  11. p   print the partition table查看分区信息  
  12. q   quit without saving changes 退出不保存  
  13. s   create a new empty Sun disklabel  
  14. t   change a partition's system id改变分区类型  
  15. u   change display/entry units  
  16. v   verify the partition table  
  17. w   write table to disk and exit 保存退出  
  18. x   extra functionality (experts only)  
  19.   
  20. Command (m for help):p  //查看新硬盘的分区  
  21. ********************************************************************  
  22. Disk /dev/sdb: 1000204 MB, 1000202273280 bytes  
  23. 255 heads, 63 sectors/track, 121601 cylinders  
  24. Units = cylinders of 16065 * 512 = 8225280 bytes  
  25. Device Boot Start End Blocks Id System  
  26. ********************************************************************  
  27. Command (m for help):n  //创建新分区  
  28. File system type  (default ext2): ext3    //输入想使用的分区格式  
  29. Partition name:  backup                      //输入分区的名字  
  30. First cylinder  (default 0cyl):                //第几个柱面,我们按照默认  
  31. Last cylinder or +size or +sizeMB or +sizeKB  (default 0cyl):+1000000M    //这里我们按大小输入 即+1000000M (注意这个M为大写)  
  32. Warning: You requested a partition from 0cyl to 121576cyl.                  
  33. The closest location we can manage is 1cyl to 121575cyl.  Is this still  
  34. acceptable to you?  
  35.    y   Yes                                                                  
  36.    n   No  
  37. 当然是y  
  38. Command (m for help): p            //查看新硬盘分区后的情况  
  39. ********************************************************************  
  40. Disk /dev/sdb: 1000 GB, 1000202273280 bytes  
  41. 255 heads, 63 sectors/track, 121601 cylinders  
  42. Units = cylinders of 16065 * 512 = 8225280 bytes  
  43.   
  44.    Device Boot      Start         End      Blocks   Id  System   
  45. /dev/sdb1               2      121576   976559157   83  Linux   
  46. ******************************************************************  
  47. Command (m for help): w  
  48. Information: Don't forget to update /etc/fstab, if necessary.            //写入硬盘分区属性并结束 

2.格式化硬盘


Shell代码 
  1. sudo mkfs -t ext4 /dev/sdb


3.手动挂载


Shell代码 
  1. sudo mount -vl -t ext4 /dev/sdb1 /opt/sync


4.开机自动挂载


Shell代码 
  1. sudo vi /etc/fstab

<file system> <mount point>   <type>  <options>       <dump>      <pass>
/dev/sdb1 /opt/sync/ ext4 defaults 0 0


  1. Shell 代码
  1. sudo mount -a #及时生效

5.重启机器查看结果


Shell代码 
  1. df -h

参考资料:http://blog.csdn.net/chief1985/article/details/4610345


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值