Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I noticed that renaming a file doesn't change its hash. I also noticed that creating an empty file gives a file of zero bytes, yet it has a filename.

Since the filename seems to travel with the file across devices I was wondering what exactly is the filename? How come it can be changed without altering the hash, and why doesn't it seem to take up any space?

I guess if I understood how they are stored, it would answer those questions.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

In NTFS, all file data—file name, creation date, access permissions (by the use of access control lists), and contents—are stored as metadata in the Master File Table. In Windows world, you might also have hear about the File Allocation Table. Other file systems have other names and structures.

All file systems work this way. A certain amount of space is reserved, usually at the very beginning of the disk, right after the boot sector. That space contains a data structure wich contains the information to retreive the files.

The Master File Table is not a file. It is just organized data. As a matter of fact, files are just data that have a beginning and a size, stored in a MFT, FAT or similiar. When you change the filename, you do not change the file, just some bytes in the Master File Table.

Since the name and attributes are different from the data, you can download a file stored on a Linux server to a Windows machine. The data is transfered, not the metadata. You have to name and select a location for the file yourself (although the server and browser can hint you the original file name).

share|improve this answer
Your explanation made me wonder how the MFT changes in size over time. How NTFS reserves space for its Master File Table (MFT) has some information about that. I thought this was interesting: NTFS reserves 12.5 percent of the volume for exclusive use of the MFT until and unless the remainder of the volume is completely used up... If the unreserved space becomes full, space for user files and directories starts to be allocated from the MFT zone... If the MFT zone becomes full, space for new MFT entries is allocated from the remainder of the disk... –  Louis Nov 28 '12 at 3:57
Intersting, I never thought of that. Thanks! –  ixe013 Nov 28 '12 at 5:45
But what if file transfer via torrent p2p or ftp?? How does it work then?? (Without dialogs) –  DrStrangeLove Jan 28 '13 at 4:14
It is protocol dependent. Many protocols have a way to send the original file metadata, such as name and creation date. HTTP uses 'content-disposition' for this. Some protocols let the user select the final name, others don't, leaving you to change it after the file is transfered. If you have a question about a specific protocol, I suggest you make it a new question. +Keep in mind that there might not even be a file on the server, like a PDF of an invoice that is generated on the fly when you ask for it. –  ixe013 Jan 28 '13 at 15:29
add comment

Your Answer


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

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