Question: Once again, here I am trying to wrap my head around some HDD and filesystem concepts.
When Windows displays a drive as having “unallocated space” and prompts for the drive to be initialised, what exactly does this mean – that the drive has no filesystem on it, or just that the filesystem isn’t recognised by Windows?
Is the concept of unallocated space a Windows one, or a hard drive one – in other words, is it possible for other operating systems to write to unallocated space?
If so, does this mean that outside of Windows, a filesystem isn’t necessary to write to a hard drive?
Answer: A hard drive (or its equivalent such as a USB thumb drive) by convention has a partition table on it. ?An MBR (master boot record) style partition table fits in one sector (512 bytes) at the beginning of the drive (sector number 0). ?An MBR also contains a boot loader so the partition table space is limited to four “primary” partitions (though some 1980s software supported eight partitions). ?Each MBR partition entry has:
- a type code (a single byte) indicating that the corresponding partition is either NTFS, FAT-32 (four flavors), FAT-16 (eight flavors), FAT-12, Linux swap area, etc. ?Partition code 0 (zero) means “raw”, or “no meaningful content”, “or disregard partition contents”.
- whether the partition is flagged as bootable. ?Up to one partition per disk can have this flag enabled.
- The disk address of the beginning sector of the partition
- The partition’s ending sector or the number of sectors. ?Early PCs used cylinder/head/sector numbers; after about 1995, use of “logical block numbers” a single 32-bit value replaced cyl/head/sect addressing
Since a maximum of four partitions was soon intolerable, a mechanism for additional partitions was “extended partitions” in MBR where a specially marked partition can have an embedded MBR containing another partition table. ?Thus it is possible to divide a disk into dozens of partitions though some partitioning tools might inflict some artificial limit.
A GPT is intrinsically not limited to four partitions. ?Its basics occupy more than 512 bytes on disk, usually something in the 4 to 16 megabyte range. ?But the meaning of partitions is the same.
A disk’s partition table which has every sector of the disk included in it has “no unallocated space” by the most common use of the phrase. ?So the usual answer to your question is that unallocated space is that outside of all partitions. ?However, ambiguity of terminology occurs if a partition is marked as type zero (raw), so there possibly could exist a tool which considers a raw partition as, in some sense, unallocated.
?
When Windows displays a drive as having “unallocated space” and prompts for the drive to be initialised, what exactly does this mean – that the drive has no filesystem on it, or just that the filesystem isn’t recognised by Windows?
It means there is no partition table or all the partition entries are empty. ?Windows is happy to ignore unrecognized filesystems.
?
Is the concept of unallocated space a Windows one, or a hard drive one – in other words, is it possible for other operating systems to write to unallocated space?
It is a hard drive convention observed by all standard operating systems supporting PC software. ?Not sure what “in other words” means. ?Yes, it is possible to write to unallocated space (even in Windows), but the proper etiquette is to create a partition containing the unallocated space, format a filesystem within it (which writes to the “unallocated space”), and then write files and directories to it.
?
If so, does this mean that outside of Windows, a filesystem isn’t necessary to write to a hard drive?
For a well behaved system, no. ?Cooperative systems require filesystems to be in place, permissions set appropriately, etc. ?However, it would be trivial in Linux (for example) to open the disk itself as a big file (raw disk access) and write directly to it. ?It would require administrative access and some guidance or calculations to determine where to write.
However, ignoring filesystems and partitions is bad. ?They greatly improve disk management and make life much easier and more sane. ?Ultimately it is possible to write renegade software which completely ignores sanity and good manners and writes anywhere on the disk it wants.
However, the meta-ness I perceive from this question might be misunderstanding whether you intend to obey the permissions and limits imposed by non-administrator/non-system mode in Windows, Linux, etc.