7

linux挂载硬盘

 3 years ago
source link: https://www.wencst.com/archives/355
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

linux挂载硬盘

作者: wencst 分类: linux,Uncategorized 发布时间: 2016-10-17 15:15 阅读: 1,442 次

用fdisk -l查看要挂载的云硬盘

fdisk /dev/vdb对新增硬盘进行分区,选择新增分区n
中间会询问是主分区还是逻辑分区,主分区选择p,逻辑分区选择e(我选p)
其余按提示进行即可,我基本是默认的

最后输入w,写入分区

mkfs -t ext3 -c /dev/vdb1用这个命令进行格式化

等到100%完成时,就可以执行下面mount操作了。
mount /dev/vdb1 /home 将新增磁盘挂载到/home文件夹下(此处注意,如果/home中存在有用的文件,需要先将文件备份出来而后再挂载)
当然最好新增一个文件夹,用于挂载此硬盘,如果发现原文件夹被覆盖,并且想要找回原文件时,将新的硬盘umount掉(umount /home),这样原文件夹就回来了。

如果想在重启以后也会自动挂载上,则需要在配置文件/etc/fstab中增加配置

/dev/vdb1 /home ext3 defaults 0 0

如果文章对您有用,扫一下支付宝的红包,不胜感激!

欢迎加入QQ群进行技术交流:656897351(各种技术、招聘、兼职、培训欢迎加入)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK