10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linuxで特定のNFSサーバを全てアンマウントする

Last updated at Posted at 2014-02-20

様々なNFSサーバがマウントされているサーバで、ある特定のNFSサーバを全てアンマウントしたいとき

# df -hP -t nfs | grep "^対象サーバの条件(IPアドレスとか)" | awk {'print $6;'} | xargs umount

dfの結果をgrepで絞り込んで、awkでdfの出力結果の6番目を取り出し、xargsにリストとして渡してumount
grepでの絞り込みは、正規表現なりなんなりをご自由に。
umountコマンドも、オプション指定が必要であれば適切にセット頂くのがよろしいかと。

ちなみにmountコマンドだと、次の通り
# mount -t nfs | grep "^対象サーバの条件(IPアドレスとか)" | awk {'print $3;'} | xargs umount

もっとスマートやり方があるはず…。誰か教えてください…。

tukiyoさんより情報頂きました!

# umount -a -t nfs -O addr=IPアドレス

こっちの方が遙かにスマートですね!

10
10
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?