A-A+

rm: cannot remove file: Disk quota exceeded

2015年12月16日 Solaris运维 评论 1 条 阅读 1,831 次

On ZFS, the filesystem that carries our homedirs, you may find yourself unable to delete files with full disk quota:

bfguser@bwui:~> cp testfile1 testfile2
cp: cannot create regular file `testfile2': Disk quota exceeded

Unfortunately you can not remove a file using the 'rm' command. E.g.:

bfguser@bwui:~> rm testfile1
rm: cannot remove file `testfile1': Disk quota exceeded

Workaround:

The trick is to copy /dev/null to the file you want to delete:

bfguser@bwui:~> ls -lah testfile1
-rw-r--r-- 1 bfguser bfggroup 16M 2009-03-23 10:44 testfile1

bfguser@bwui:~> cp /dev/null testfile1
bfguser@bwui:~> ls -lah testfile1
-rw-r--r-- 1 bfguser bfggroup 0 2009-03-23 11:41 testfile1

bfguser@bwui:~> rm testfile1
bfguser@gwui:~> ls -lah testfile1
/bin/ls: testfile1: No such file or directory

Explanation:

ZFS is a copy-on-write filesystem, so a file deletion transiently takes slightly more space on disk before a file is actually deleted. It has to write the metadata involved with the file deletion before it removes the allocation for the file being deleted. This is how ZFS is able to always be consistent on disk, even in the event of a crash.

1 条留言  访客:1 条  博主:0 条

  1. 胡海琳

      网上认识一女孩,声音很甜,我便问她:“你长啥样啊?让我看看庐山真面目呗。”
      然后她发来一张山的照片,我顿时很生气:“我要看的不是庐山的照片!”
      她说:“我知道你不想看庐山啊,我发的这张是黄山。”

给我留言

Copyright © 2011-2016 零下二十四度Theme By  Ality  京ICP备16007547号   关于本站

用户登录