5

I know that a sector is the unit in which a track is splitted, but I had this doubt since I was looking for information about the maximum number of pointers that an inode can support. I found that this number depends of the block size. Is this size variable? Is this size maintained when the computer is switched off? Thank you for the help, I have spent some time looking for this but i´m not sure.

  • Sector describes an actual physical area. The meaning of "block" depends on the context, and may be prefixed with a descriptor such as "physical" or "logical". Seems like you are reading about a "block" in the context of a filesystem? – sawdust Aug 5 '16 at 22:23
  • Yes, I´m now studying the structure of a disk in a Unix system. – alberto Aug 6 '16 at 10:22
6

Once a file system is established the block size remains the same. Some partitioning tools can change this after the fact, but not while the OS is running.

A sector has traditional been a fixed 512 byte size, but a few drives have 4096 bytes sectors.

A sector is the smallest individual reference-able regions on a disk.

The block size refers to the allocation size the file system uses. The common options are 512, 1024, 2048, 4096, 8192, 16384, or 32678. Generally anything larger would be so inefficient nobody would use it, and you can't go smaller than 1 disk sector.

Sure you can write 10 bytes to a file, but behind the scenes it is allocated 1 block whether you use it all or not.

|improve this answer|||||
  • So... the blocks´ size can be changed modifying the filesystem right? Two more questions, that in fact are more or less the same: the inode table has always the same size? The number of pointers to disk blocks is also always the same? I suppose the inode table adapts its size to the size of the filesystem to support all the free space, but I wasn´t sure about that – alberto Aug 5 '16 at 20:51
  • "The number of pointers to..." Each file and folder has a pointer to a block, when a new file/folder is added it is assigned an unused block. The total number of block is determined by the disk size/block size. So if you re-partition the total blocks could increase or decrease, but online off line. The size of the inode table is determined, by the number and size of the files it is storing. The free space has no inodes pointing to them. – cybernard Aug 5 '16 at 21:41
  • Technically a file system block can be smaller than a storage block. Such might even almost make sense if the page size supported by hardware was smaller than the sector size of storage. (Packing more than one file/object into a sector, i.e., treating such as a special case, might be more attractive.) The other portion of the sector would be considered a prefetch on a read; writes are somewhat more problematic since a smaller block size could sometimes require a read of the rest of the sector. Still it is a theoretical possibility. – Paul A. Clayton Aug 6 '16 at 0:12
  • It it theoretical possible as you say, but given the standard sector size of 512 bytes for decades, I have never seen that implemented. I have studied the efficiency (typical), and usually a 512 byte block size results in %0.2 to %1 of the drive being wasted. The filesystem overhead increases dramatically when you go below 512 bytes so much so you probably lose more than the <1% you would have lost with the 512 byte block size. The industry generally agrees 4k is the right size, which is why some new hard drives have 4k sectors. – cybernard Aug 6 '16 at 0:45

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.