LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1414|回复: 9

[已解决]关于mount --bind的问题

[复制链接]
发表于 2009-8-13 20:46:48 | 显示全部楼层 |阅读模式
有没有人做过这样的实验:
我的家目录下面有两个目录pics和work两个目录,
我先用sudo mount --bind pics/ work/,然后执行
sudo mount --move pics/  work/,结果就有了下面的出错信息了。
mount: wrong fs type, bad option, bad superblock on /home/ru****/pics,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

一怒之下,决定用rm -rf work 删除,发现不行,说是
rm: cannot remove directory `work': Device or resource busy,
加了sudo还是删除不了,但如果重启之后,就可以正常删除了,不知道这是什么原因,可有人愿意试一试?
发表于 2009-8-14 04:50:52 | 显示全部楼层
Post by ru****999;2015957
有没有人做过这样的实验:
我的家目录下面有两个目录pics和work两个目录,
我先用sudo mount --bind pics/ work/,然后执行
sudo mount --move pics/  work/,结果就有了下面的出错信息了。
mount: wrong fs type, bad option, bad superblock on /home/ru****/pics,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

一怒之下,决定用rm -rf work 删除,发现不行,说是
rm: cannot remove directory `work': Device or resource busy,
加了sudo还是删除不了,但如果重启之后,就可以正常删除了,不知道这是什么原因,可有人愿意试一试?

  1. dmesg | tail
复制代码
??
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-14 12:36:56 | 显示全部楼层
这是详细操作,请看一看是什么问题
  1. ru****@ru**** ~ $ sudo mount --bind  test1 test2
  2. ru****@ru**** ~ $ sudo mount --move test1 test2
  3. mount: wrong fs type, bad option, bad superblock on /home/ru****/test1,
  4.        missing codepage or helper program, or other error
  5.        In some cases useful info is found in syslog - try
  6.        dmesg | tail  or so

  7. ru****@ru**** ~ $ dmesg | tail
  8. [    8.717846] kjournald starting.  Commit interval 5 seconds
  9. [    8.717856] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
  10. [    8.718036] EXT3 FS on hda9, internal journal
  11. [    8.718041] EXT3-fs: mounted filesystem with writeback data mode.
  12. [    8.763205] kjournald starting.  Commit interval 5 seconds
  13. [    8.763212] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
  14. [    8.763366] EXT3 FS on hda10, internal journal
  15. [    8.763370] EXT3-fs: mounted filesystem with writeback data mode.
  16. [   10.384823] Adding 682720k swap on /dev/hda8.  Priority:-1 extents:1 across:682720k
  17. [   13.944871] eth0: Media Link On 100mbps full-duplex
  18. ru****@ru**** ~ $
复制代码
回复 支持 反对

使用道具 举报

发表于 2009-8-14 13:29:50 | 显示全部楼层
Post by ru****999;2016159
这是详细操作,请看一看是什么问题
  1. ru****@ru**** ~ $ sudo mount --bind  test1 test2
  2. ru****@ru**** ~ $ sudo mount --move test1 test2
  3. mount: wrong fs type, bad option, bad superblock on /home/ru****/test1,
  4.        missing codepage or helper program, or other error
  5.        In some cases useful info is found in syslog - try
  6.        dmesg | tail  or so

  7. ru****@ru**** ~ $ dmesg | tail
  8. [    8.717846] kjournald starting.  Commit interval 5 seconds
  9. [    8.717856] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
  10. [    8.718036] EXT3 FS on hda9, internal journal
  11. [    8.718041] EXT3-fs: mounted filesystem with writeback data mode.
  12. [    8.763205] kjournald starting.  Commit interval 5 seconds
  13. [    8.763212] EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
  14. [    8.763366] EXT3 FS on hda10, internal journal
  15. [    8.763370] EXT3-fs: mounted filesystem with writeback data mode.
  16. [   10.384823] Adding 682720k swap on /dev/hda8.  Priority:-1 extents:1 across:682720k
  17. [   13.944871] eth0: Media Link On 100mbps full-duplex
  18. ru****@ru**** ~ $
复制代码

你知道mount --move是什么意思吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-14 14:01:55 | 显示全部楼层
我是在网上看了这么一段话,然后自己练习的。
14. mount --bind是什么意思?

mount --bind 是将一个目录中的内容挂载到另一个目录上,用法是

# mount --bind olddir newdir

这个命令使得自己搭建的FTP要共享某个目录的时候变得特别方便。如果要取消mount用命令:

# mount --move olddir newdir 即可。

如果mount --bind 也想写入fstab中的话格式如下:

olddir newdir none bind 0 0

现在我用mount --bind olddir newdir把一个目录挂载到另外一个目录上,想取消,所以就用
mount --move olddir newdir 命令来取消,结果就出错了。
所以mount --move应该是取消这种目录挂载吧,不知道我理解的对不对,还请详细解释一下。
回复 支持 反对

使用道具 举报

发表于 2009-8-14 14:04:55 | 显示全部楼层
mount --bind之后取消一直都用umount的路过
回复 支持 反对

使用道具 举报

发表于 2009-8-14 14:34:21 | 显示全部楼层
Post by ru****999;2016176
我是在网上看了这么一段话,然后自己练习的。

现在我用mount --bind olddir newdir把一个目录挂载到另外一个目录上,想取消,所以就用
mount --move olddir newdir 命令来取消,结果就出错了。
所以mount --move应该是取消这种目录挂载吧,不知道我理解的对不对,还请详细解释一下。

你误会了。如果你要取消就用umount

--move是说把原本mount在olddir的deivce移到(umount+mount到)newdir上。
例如:
  1. mount -t ext3 /dev/sda3 /olddir
  2. mount --move /olddir /newdir
复制代码
回复 支持 反对

使用道具 举报

发表于 2009-8-14 14:52:52 | 显示全部楼层
Post by mathfeel;2016182
你误会了。如果你要取消就用umount

--move是说把原本mount在olddir的deivce移到(umount+mount到)newdir上。
例如:
  1. mount -t ext3 /dev/sda3 /olddir
  2. mount --move /olddir /newdir
复制代码


楼上的是正解!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-14 15:04:12 | 显示全部楼层
谢谢各位热心帮助,今天又学了点东西。
回复 支持 反对

使用道具 举报

发表于 2009-8-15 10:15:34 | 显示全部楼层
Post by mathfeel;2016182
你误会了。如果你要取消就用umount

--move是说把原本mount在olddir的deivce移到(umount+mount到)newdir上。
例如:
  1. mount -t ext3 /dev/sda3 /olddir
  2. mount --move /olddir /newdir
复制代码


学习了,以前总是umount之后再mount
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表