-2

I have a disk that has too many small files:

df:

/dev/mapper/mpathc 6056822144 6056822144 0 100% /file3

df -i:

/dev/mapper/mpathc 384589824 12160314 372429510 4% /file3

I need to move small files on same disk like this:

mv /file3/bla/bla/23423/bla/file1.txt /file3/newpath/

But getting error like this:

mv: writing ... No space left on device

Moved some files to other disk (300GB), but df command cannot update. I must have 300GB free disk space, but I can't use.

I tried lsof command, nothing run on this disk. I tried umount and mount again, there is no change.

What can I do for use this disk spaces?

Thank you

onur
  • 105
  • 2
    Stop whatever process is still writing to your disk. – Michael Hampton Aug 15 '16 at 07:03
  • There is no process writing to disk. I tried lsof command, there is nothing. – onur Aug 15 '16 at 07:06
  • @phe Clean up some old junk? `du -m /file3 | sort -n` will find the largest files on your drive. – Ryan Babchishin Aug 15 '16 at 07:13
  • There is no junk files. Just have too many .txt files which I have. – onur Aug 15 '16 at 07:23
  • Not sure what you mean by "df command cannot update" but if you can run `df -i`, it might point you in the right direction. – Julie Pelletier Aug 15 '16 at 07:28
  • BTW, `lsof` will not tell you the actual location of the open file if it was deleted while still in use. It will instead show it as being on `/`. – Julie Pelletier Aug 15 '16 at 07:30
  • So how can I found which process still writing on disk? – onur Aug 15 '16 at 07:36
  • 1
    If you can unmount and remount, then open files are not your problem. Can you `touch` a file? If you can, I think your problem is that you are moving files to a directory that needs to extend, and there is no place to extend. If you cannot, then did you get a read-only error? What file-system is this? If ext2/3/4 what does `# dumpe2fs -h /dev/sda2 | grep '^Reserved block count'` say? Is it mounted off a SAN, and if so off what make of SAN disk? Do I understand correctly that you have moved files away to another disk, that those files are no longer there, but that "df used" does not diminish? – Law29 Aug 15 '16 at 08:11
  • Reserved block count : 30766887. It's ext4. I moved files away to another disk, those files are no longer there (~300GB). Df does not diminish. – onur Aug 15 '16 at 08:17
  • Unmount and remount the filesystem. – Michael Hampton Aug 15 '16 at 08:28
  • I tried unmount and remount. There is no change. – onur Aug 15 '16 at 08:31
  • Can you further explain why you think `mv /file3/bla/bla/23423/bla/file1.txt /file3/newpath/` will work? Actually you only copy file from one folder to another? – Simon MC. Cheng Aug 15 '16 at 09:48
  • 1
    see this http://unix.stackexchange.com/questions/222221/how-to-fix-intermittant-no-space-left-on-device-errors-during-mv-when-device-h – Ijaz Ahmad Aug 15 '16 at 09:51
  • If there are some reserved blocks on filesystem, try tune2fs -m 0 /dev/mapper/mpathc (if it is some of ext filesystems) – Boban P. Aug 15 '16 at 11:36
  • I tried `tune2fs -m 0`, nothing change. How can I move to file without mv command? Mv first create a copy in newpath and after delete in oldpath. If disk is full, mv can't create newpath. – onur Aug 16 '16 at 06:27

1 Answers1

5

The df and df -i reports are mixed up. The first one is from df -i, the second from df. The df -i report shows that the disk has no more inodes available, so no more files can be created on that disk, despite the df showing that the disk has plenty of space available. Inability to create inodes will cause mv to fail. To do anything on that drive, files will have to be deleted from it, by cping them onto another file system and then rming them from /file3, or similar.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Jonah Benton
  • 1,252
  • 7
  • 13
  • Are you sure about this? It doesn't make sense for a filesystem to have 384589824 blocks and 6056822144 inodes. That's more than 15x as many inodes as blocks, if what you say is true! Nearly all of those files would have to be empty. – Michael Hampton Aug 15 '16 at 17:47
  • You are wrong. First one is from `df`, second one is from `df -i`. – onur Aug 16 '16 at 06:21
  • Ok- if the first report is in fact from df and not df -i, then take a look at the comment on the question from @ijaz-khan pointing at http://unix.stackexchange.com/questions/222221/how-to-fix-intermittant-no-space-left-on-device-errors-during-mv-when-device-h. This may be what's blocking mv on the same file system. However, while disabling dir_index as described may allow in-file-system mv to succeed, the file system is still out of data blocks. Files will need to be moved off of the file system mounted on /file3 on to a different file system for any other work to occur. – Jonah Benton Aug 16 '16 at 15:05