flat assembler
Message board for the users of flat assembler.

Index > Heap > Why can WinXP 32bit read a 4-TB-HDD ?

Author
Thread Post new topic Reply to topic
80286



Joined: 01 May 2015
Posts: 15
80286
Hello there,

I have an external USB-4TB-HDD connected to my 32bit-XP-Computer. With 32 bit only 2 TB should by adressable (the main reason for (U)EFI I read).
So why can 32bit-XP recognize that size? Size is shown correctly (4.000.778.620.928 bytes).
I actually didn't use more than 2 TB (not even close), so maybe there is a surprise if I try.

Thanks for clarification Smile
Post 04 May 2015, 17:32
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
32-bit CPU, does not mean that the processor can't process bigger numbers. They are simply placed in two sequential double words and processed by several instructions, instead of one. Example of 64 bit operation can be addition of two 64 bit variables - Var2 = Var1 + Var2:
Code:
Var1  dq ?
Var2  dq ?

mov   eax, dword [Var1]
mov   edx, dword [Var1+4]
add   dword [Var2], eax
adc   dword [Var2+4], edx    
Post 04 May 2015, 21:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17249
Location: In your JS exploiting you and your system
revolution
The reason is the sector size. XP is only able to use a sector size of 512 bytes, and the file system drivers are limited to 2^32 sectors.

2TB = 2^32 sectors * 512 bytes per sector

Drives larger than 2TB use a sectors size of 4kB, so XP can't access them unless you format it to 2TB and use the compatibility mode of the drive with 512 byte sector emulation.

Note that even the latest 64-bit versions of Windows still have the 2^32 sector limitation hard coded, so even with 4kB sector size the new limitation is 16TB.

Edit:
Note While not stressed in the preceding table, Windows XP, Windows Server 2003, and Windows Server 2003 R2 do not support 512e or 4Kn media. While the system may boot up and be able to operate minimally, there may be unknown scenarios of functionality issues, data loss, or sub-optimal performance. Thus, Microsoft strongly cautions against using 512e media with Windows XP or other products based on the Windows XP codebase (such as Windows Home Server 1.0, Windows Server 2003, Windows Server 2003 R2, Windows XP 64-bit Edition, Windows XP Embedded, Windows Small Business Server 2003, and Windows Small Business Server 2003 R2).
Post 04 May 2015, 23:47
View user's profile Send private message Visit poster's website Reply with quote
80286



Joined: 01 May 2015
Posts: 15
80286
revolution wrote:
The reason is the sector size.

Yes, thank you, I think that is the solution.
If I use HxD on that HDD it counts 976754646 sectors what makes 4 TB with 4KiB-sectors.
And offset for sector 1 (starting at sector 0) is shown as 1000h what indicates 4KiB-sectors, too.

In addition, there is no bootprogram in the first sector, only a partition table with AA55h at offset 01FEh (actually no tool to translate the values; I hope I can soon code one by my own with FASM).
Interesting to me somehow this 4KiB-sector with bootmarker at 1FEh, but I think I will not try to format that HDD on that system. If time has come I will experiment with a second HDD of at least that size on the Windows 8.1 64-bit-system.

revolution wrote:
Note that even the latest 64-bit versions of Windows still have the 2^32 sector limitation hard coded, so even with 4kB sector size the new limitation is 16TB.

That's an interesting note, too!
Post 05 May 2015, 04:02
View user's profile Send private message Reply with quote
zir_blazer



Joined: 05 Dec 2006
Posts: 66
zir_blazer
No one mentioned than the 2 TiB barrier is actually a limitation from the Master Boot Record (MBR) partition table, not exactly related to the 32 Bits world or BIOS at all. The MBR defines both partitions and some legacy things related to the booting process. The BIOS interacts with the MBR since its part of the bootstrap process.

http://en.wikipedia.org/wiki/Master_boot_record#System_bootstrapping

Now, UEFI also includes a new partition table, GUID Partition Table (GPT). This one is more flexible in both partition amount and size. However, you do not need neither 64 Bits or UEFI to use it. You just need an OS with GPT support. On Linux, you can even use GPT in BIOS based computers with Boot Loaders like Syslinux that can embed a very small GPT Driver on the Protective MBR, so you can actually boot from a GPT formatted disk on a BIOS based computer.

Also, Windows XP 32 Bits does NOT support GPT at all. WXP x64 could see them if you use them as a secondary storage disk. Not sure why it works on your particular case. Some vendors actually offered some compatibility tools for their drives for Windows XP to access the space beyond what MBR can address in non conventional ways (Similar to the boom of RAMDiskes for 32 Bits Windows to use the RAM that can't be directly addressed).


Last edited by zir_blazer on 08 May 2015, 01:21; edited 2 times in total
Post 08 May 2015, 01:13
View user's profile Send private message MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17249
Location: In your JS exploiting you and your system
revolution
zir_blazer wrote:
No one mentioned than the 2 TiB barrier is actually a limitation from the Master Boot Record (MBR) partition table, not exactly related to the 32 Bits world or BIOS at all.
Yes, but that is slightly different in that it only affects the partitioning. The underlying hardware differences with sectors sizes still exists regardless of MBR or GPT.
Post 08 May 2015, 01:19
View user's profile Send private message Visit poster's website Reply with quote
zir_blazer



Joined: 05 Dec 2006
Posts: 66
zir_blazer
revolution wrote:
zir_blazer wrote:
No one mentioned than the 2 TiB barrier is actually a limitation from the Master Boot Record (MBR) partition table, not exactly related to the 32 Bits world or BIOS at all.
Yes, but that is slightly different in that it only affects the partitioning. The underlying hardware differences with sectors sizes still exists regardless of MBR or GPT.

As far that I know, even on the Advanced Formats based disks that have 4 KiB sectors, they still have hardwired emulation for logical 512 Bytes sized ones (512e). Basically, you can't actually use them in native 4 KiB mode. It seems that very new models are using it, but I doubt he has one of these that can justify that it works on WXP 32 Bits:

http://en.wikipedia.org/wiki/Advanced_Format#4K_native
Post 08 May 2015, 01:25
View user's profile Send private message MSN Messenger Reply with quote
zir_blazer



Joined: 05 Dec 2006
Posts: 66
zir_blazer
Well, this seems to be the reason:

http://superuser.com/questions/852475/how-can-a-mbr-formatted-hard-drive-exceed-1-81-tib-capacity

After all, it did was sector size. I'm surprised. IIRC it was announced that WXP couldn't work with native 4 KiB sectors for some reason.
Post 08 May 2015, 01:35
View user's profile Send private message MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17249
Location: In your JS exploiting you and your system
revolution
So external vs internal drives behave differently? XP can access external drives with different sector sizes?
Post 08 May 2015, 01:45
View user's profile Send private message Visit poster's website Reply with quote
80286



Joined: 01 May 2015
Posts: 15
80286
revolution wrote:
So external vs internal drives behave differently? XP can access external drives with different sector sizes?

I don't know whether this can answer your question, but:
1. On my USB-4TB-HDD there partition table says (here only LBA-values explained, using little endians) :
a) not active partition (byte at 01BEh = 0 )
b) partition starts at sector 2048 (00 08 00 00h)
c) size of partition is 976752594 sectors (D2 0F 38 3A)
d) partitiontypebyte at 01C2h is 07h => NTFS
There are 6 bytes directly before the partitiontable. I don't know there meanings. AA A2 A9 90 00 00

2. Bootsector of first (and only) partition, sector 2048 = offset 800000h, says:
a) NTFS
b) bytes per sector: 00h 10h = 1000h = 4096
c) sectors per cluster: 01
d) the 8 reserved bytes starting at 001Ch that should all be 00h show 00 08 00 00 00 00 00 00. Maybe "08" belongs to the number of normal 512-byte-sectors? Maybe it means nothing at all...
e) total number of sectors in logical drive: 976752593 (D1 0F 38 3A)
(and some more infos about clusters etc., followed by bootloader)

Because of 2. b) I believe at least 16 TB-HDDs could be used as storage-device with 32bit-XP. That value can easily be changed, e. g. 64kib-sectors. Only the drive must be formatted accordingly. Than 256TiB-HDDs could be accessible - with WinXP-32-Bit Smile

For all those external HDDs > 2 TB for Windows I just checked online they all only are offered as storage-devices. None of them is said to be bootable. (But I didn't check all availables, so might be there are some.)
Post 08 May 2015, 15:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.