0

if i write 4 charcters to a file its size is 4 bytes but what about the title and the meta data like my pc and stuff where are they stored?

1 Answers1

2

The file size os normally the number ob bytes of content inside the file. What's not shown in this number is metadata (filename, date of creation, access time, access rights and so on). All this stuff is stored in the filesystem tables itself. And here it really depends on what filesystem is used! What's also no shown (but present in most file system implementations) is the real size that the file uses on the disk (because most (all?) file systems organize the space in blocks and a file always occupies w whole number of blocks, so a file that would require 1.1 blocks will occupy 2 whole blocks) Some filesystems (like NTFS) can even store the content of small files inside the meta data, so there is no need to waste a whole block on the storage medium for tiny files.

What amount of meta data is stored and how is different for every filesystem.

kruemi
  • 245
  • 2
  • 5
  • so if the meta data is not stored with the file itself why when i transforma file from a pc to another pc the file get transfered with the meta data – random dude Sep 08 '20 at 10:16
  • 1
    Because the meta-data is transferred by the application, protocol, or system that does the transfer. Otherwise it would just be an unnamed blob of random data. If you zip a file up then the zip file contains information on the filename, size, date, amount of data and so on. You'll notice that if you zip up a 4 byte file that the output is likely significantly more than 4 bytes. Likewise in order to move to another system via USB that filesystem data gets copied to the new filesystem. Over the internet the meta-data is handled by the protocols used. – Mokubai Sep 08 '20 at 11:23
  • If you only want to transfer the contents of a file you can use "dd" or "cat" on unix/linux systems or "type" on dos/windows based systems to get the contents and than pipe it into another file. Without the metadata your OS (and you) would not be able to find the content of a file on a storage medium. – kruemi Sep 08 '20 at 11:38