In Ubuntu and ext4, how do folders work exactly?

Are they solely virtual and take up no disc space? Do they actually take up space? Can I fill up my 1TB backup drive with nothing but folders?

(slightly unrelated, but...) Is it possible to delete a folder but keep the files existing? Basically "orphan" the files? [I do not mean mving the files, I mean deleting ONLY the folder the files are in, but not the files.

In general, how do inodes even work?

  • 1
    I will shoot one thing: it is impossible that folders don't take space on the disk. Someone, somewhere have to save all the information and that means it will take space. – Lucio Aug 30 '14 at 21:54
  • Ofcourse. I don't know the details but I am pretty sure you can fill up your 1TB hard drive with just folders, because even the name of each folder has to be stored somewhere aka the disk. – hytromo Aug 30 '14 at 22:08

As @hakermania said it has to be written somewhere, so it takes space. Plus ext4 has jurnal, so additional information is written and you don't know were data is physically on hard drive (in opposite to ext2) so even shred doesn't work.

It is possible to restore any file deleted on ext4, but they are deleted if you delete the forlder (they need to be somewhere).

As for inodes and more information on folderd, it's explained very well in this article: https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout so copying it has no sense.

  • 1
    I meant that by deleting folder, you delete the files inside, because there is no folder for as @Whaaaaaat called them "orphan" files and that you can restore them if they were not overwritten physically on hard drive. Sorry for confusion, English is not my native language. – przemo Aug 30 '14 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.