Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The root directory of my ecryptfs filesystem has grown massively since I accidentally created many thousands of files in it. Now that I've deleted the files, I'd like to shrink the directory, as I believe it's causing some performance problems.

My home directory before the ecryptfs mount:

dr-x------ 2 ian ian 4096 May  4  2012 /home/ian

and after:

drwx------ 104 ian ian 42721280 Jun 18 13:46 /home/ian

http://serverfault.com/questions/264124/shrink-reset-directory-size discusses a similar problem with an ext3 filesystem, and suggests doing an e2fsck -D. However, ecryptfs doesn't seem to have its own fsck.

How can I shrink my directory without creating a new filesystem and copying everything over?

share|improve this question
Have you checked that it's not in fact the underlying filesystem that has this directory size? – frostschutz Jun 18 '13 at 12:07
Yep -- have added details to the question. – Flup Jun 18 '13 at 12:50
You're comparing different directories. /home/ian/ (in ecryptfs) correlates to /home/ian/.ecryptfs/... (somewhere in the underlying filesystem). – frostschutz Jun 18 '13 at 14:31
Gah, you're right, I'd completely misunderstood how it works. I'd imagined ecryptfs as a big monolithic blob that gets mounted as a filesystem, whereas in fact there's a one-to-one mapping between encrypted and plaintext files. If you want to correct my stupidity in an answer, I'd be happy to accept it :) – Flup Jun 18 '13 at 15:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.