开发者社区> 问答> 正文

挂载磁盘写入的启动项删除命令

liunx 在挂载磁盘时,官方教程写入新分区,加入启动项


[font='microsoft yahei']echo '/dev/xvdb1  /mnt ext3    defaults    0  0' >> /etc/fstab
[font='microsoft yahei']

[font='microsoft yahei']可是注释这个启动项的时候好累,官方为何只有加入启动的教程,没有注释的!!!!!!!百度搜也没搜明白,原来小白吧
[font='microsoft yahei']

左整右整,最后在工单帮助下注释了启动项,可也没弄明白怎么注释掉的


我用的命令是这样的:
#umount -a
#vi /dev/fstab
/dev/xvdb1  /mnt ext3    defaults    0  0


怎么也注释不掉。。。。 求完整命令






展开
收起
万粉 2015-05-11 13:21:20 6125 0
2 条回答
写回答
取消 提交回答
  • 回1楼dongshan8的帖子
    谢谢版主回复/

    etc/fstab 文件用什么打开呢,用记事本打开是乱码

    如果已经加入启动项了,怎么注释呢

    我上面的命令,错误在哪里呢,就是注释不掉。。。

    -------------------------

    Re挂载磁盘写入的启动项删除命令

    b0VIM 7.2      瘝轙B !  root                                    iZ28sjckd00Z                            /etc/fstab                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   utf-8
    U3210    #"! U                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ad  ?  6
                  ?  ?  ?  ?  s  '  %  ?  ?  E  ?  ?  c
      9
      8
      7
      6
      ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ######################################################################################/dev/xvdd1  /www1 ext3    defaults    0  0   /dev/xvdc1  /www ext3    defaults    0  0 none                  /proc/xen               xenfs   defaults        0 0 proc                    /proc                   proc    defaults        0 0 sysfs                   /sys                    sysfs   defaults        0 0 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0 tmpfs                   /dev/shm                tmpfs   defaults        0 0 UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 1 1 # # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # Accessible filesystems, by reference, are maintained under '/dev/disk' # # Created by anaconda on Thu Aug 14 21:16:42 2014 # /etc/fstab #  




    这是/etc/fstab  里的启动项文件,好像和在主机里看到的不一样

    -------------------------

    回3楼dongshan8的帖子
    版主大人,这是我进服务器看的图,该删除哪部分呢,感谢版主

    -------------------------

    回3楼dongshan8的帖子
    让挂载在/mnt 目录上的磁盘  /xvdc1  不要启动  

    -------------------------

    回7楼dongshan8的帖子
    版主大人,我进入服务器后用命令

    umount -a

    vi /dev/fstab

    # /dev/xvdc1 /mnt ext3 defaults 0 0

    出现错误,如附件,这个注释对菜鸟来说难度太大了  用 cat /etc/fstab 查看,启动项还在

    -------------------------

    回7楼dongshan8的帖子
    还是有障碍啊,版主大人,给个命令吧,让我研究研究

    进入服务器依次输入命令
    vi /dev/fstab
    a
    # /dev/xvdc1 /mnt ext3 defaults 0 0
    键盘左上角esc
    a
    回车
    wq

    还是没有注释掉 /xvdc1 这块磁盘的启动项

    -------------------------

    回11楼dongshan8的帖子
    谢谢版主大人,搞定了
    2015-05-14 20:56:53
    赞同 展开评论 打赏
  • 旺旺:nectar2。
    楼主您好,

    如果您不想数据盘在每次重启时自动挂载,那可以将数据盘的配置从/etc/fstab文件中删除。

    要挂载数据盘时,直接用命令 mount -t ext3 /dev/xvdb1  /mnt 为挂载喔。

    建议您在编辑/etc/fstab文件时,要谨慎,如果有错,系统可能启动失败喔。

    祝您生活愉快。


    -------------------------

    回 2楼(万粉) 的帖子
    “万粉”,您好:

    一般来说,您用其它比“记事本”稍多一点功能的程序打开,可能比较方便查看和编辑喔,如“Notepad2”( http://www.flos-freeware.ch/notepad2.html

    对写进/etc/fstab文件中的数据盘记录行,可用您喜欢的编辑程序删除,应该就可以了喔。但要谨慎,不要影响到其它内容行。

    如能贴出您现在的/etc/fstab内容,有助于坛友给您提建议喔。

    -------------------------

    回 5楼(万粉) 的帖子
    您好,

    估计可以这样试试,

    将原:

    /dev/xvdc1 /mnt ext3 defaults 0 0

    换成:

    # /dev/xvdc1 /mnt ext3 defaults 0 0

    即在原一行中最前边添加符号 #。

    期待着您的回复喔。


    -------------------------

    回 8楼(万粉) 的帖子
    您好,

    建议您先看一下vi这个文本编辑器的基本操作,如您这里的例子,

    应该是修改好内容后,按一下Esc键,切换到命令状态,然后再输入:wq,表示“写入和保存”。

    请参考这里的一篇文章: http://www.blogjava.net/zJun/archive/2006/07/05/56826.html

    -------------------------

    回 10楼(万粉) 的帖子
    您好呀,万粉:

    我为您实验了一下,以下命令应该可以的:

    进入服务器依次输入命令
    vi /dev/fstab
    a
    # /dev/xvdc1 /mnt ext3 defaults 0 0
    键盘左上角esc
    : (冒号,右手近回车键的地方)  
    wq


    2015-05-11 20:44:45
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多