您的位置:首页 > 其它

Ubuntu 14.04 LTS 如何挂载硬盘

2016-08-17 18:14 323 查看



1.创建分区

Shell代码

sudo fdisk /dev/sdb

Shell代码

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.格式化硬盘

Shell代码

sudo mkfs -t ext4 /dev/sdb



3.手动挂载

Shell代码

sudo mount -vl -t ext4 /dev/sdb1 /opt/sync



4.开机自动挂载

Shell代码

sudo vi /etc/fstab

<file system> <mount point> <type> <options> <dump> <pass>

/dev/sdb1 /opt/sync/ ext4 defaults 0 0

Shell 代码

sudo mount -a #及时生效

5.重启机器查看结果

Shell代码

df -h

参考资料:http://blog.csdn.net/chief1985/article/details/4610345
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: