Directory size grows when creating/deleting thousands of files

Bug #1474493 reported by Daryl Lublink
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Run the attached bash script. ( it might cause wear and tear on your hard drive ).

What I expect should happen :

Folder size of test should be 4.0K like before I ran the test.

What actually happened :

Folder size is not 2.1M ( 2138112 bytes ).

There does not seem to be any way to recover the 2 megabytes lost and the only way to get the folder size back to 4.0K is to delete it and recreate it.

lsb_release -rd :
Description: Ubuntu 14.04.1 LTS
Release: 14.04

apt-cache policy linux-generic :
linux-generic:
  Installed: 3.13.0.35.42
  Candidate: 3.13.0.57.64
  Version table:
     3.13.0.57.64 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
 *** 3.13.0.35.42 0
        100 /var/lib/dpkg/status
     3.13.0.24.28 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

This also affects other versions of Ubuntu, including but not limited to Ubuntu 10.04 and Ubuntu 12.04

Revision history for this message
Daryl Lublink (dlublink) wrote :
Brad Figg (brad-figg)
affects: linux-meta (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
tags: added: kernel-bug-exists-upstream kernel-da-key
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

If you delete a file, and space does not get freed, it's usually either because the file is still kept open, or there are other hardlinks to it.

Can you run:
lsof | grep deleted

Revision history for this message
Daryl Lublink (dlublink) wrote :

Even if the files are huge, the size of the folder doesn't change. If I create 100,000 5 byte files or 100,000 1mb files, the folder size is about 2mb after I delete all the files.

However, it should be noted that when using much bigger files ( 200mb+ ), the folder size can be slightly bigger, but it is not the size of the deleted files.

I added a modified script.

lsof | grep deleted shows nothing.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.