Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

large FAT 32 partition problems



I'd like to be able to create and format a single FAT32 partition on a 1 TB hard disk which can be read by Windows XP.

I've tried to do it with NetBSD/i386 5.0 using the following steps, but when it's connected to a Win XP machine Windows says the free space is 417 GB, although its Disk Management tool shows the true size of 931 GB, in one place at least.

Mac OS X can make such a partition which Windows recognises correctly, but I'd like to be able to do it with NetBSD.

These are the commands I used (I've tried using a sysid value of both 11 and 12 when creating the partition with fdisk):


tk#
tk# fdisk wd1
fdisk: primary partition table invalid, no magic in sector 0
Disk: /dev/rwd1d
NetBSD disklabel disk geometry:
cylinders: 1938021, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
total sectors: 1953525168

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 1953525168

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
tk#
tk# disklabel wd1
# /dev/rwd1d:
type: ESDI
disk: ST31000333AS
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 1938021
total sectors: 1953525168
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
a: 1953525168 0 4.2BSD 0 0 0 # (Cyl. 0 - 1938020) d: 1953525168 0 unused 0 0 # (Cyl. 0 - 1938020)
disklabel: boot block size 0
disklabel: super block size 0
tk#
tk# dd if=/dev/zero of=/dev/rwd1d count=8k
8192+0 records in
8192+0 records out
4194304 bytes transferred in 0.832 secs (5041230 bytes/sec)
tk#
tk# fdisk -u wd1
fdisk: primary partition table invalid, no magic in sector 0
Disk: /dev/rwd1d
NetBSD disklabel disk geometry:
cylinders: 1938021, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
total sectors: 1953525168

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 1953525168

Do you want to change our idea of what BIOS thinks? [n]

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Which partition do you want to change?: [none] 0
The data for partition 0 is:
<UNUSED>
sysid: [0..255 default: 169] 12
start: [0..121601cyl default: 63, 0cyl, 0MB]
size: [0..121601cyl default: 1953525105, 121601cyl, 953870MB]
bootmenu: []

Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
    start 63, size 1953525105 (953870 MB, Cyls 0-121601/80/63)
        PBR is not bootable: All bytes are identical (0x00)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Which partition do you want to change?: [none]

We haven't written the MBR back to disk yet.  This is your last chance.
Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
    start 63, size 1953525105 (953870 MB, Cyls 0-121601/80/63)
        PBR is not bootable: All bytes are identical (0x00)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Should we write new partition table? [n] y
tk#
tk# disklabel wd1
# /dev/rwd1d:
type: ESDI
disk: ST31000333AS
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 1938021
total sectors: 1953525168
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

5 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
d: 1953525168 0 unused 0 0 # (Cyl. 0 - 1938020) e: 1953525105 63 MSDOS # (Cyl. 0*- 1938020)
disklabel: boot block size 0
disklabel: super block size 0
tk#
tk# date
Thu May 14 14:19:08 EST 2009
tk#
tk# newfs_msdos -F 32 -L MLA1TB /dev/rwd1e
/dev/rwd1e: 1949717088 sectors in 243714636 FAT32 clusters (4096 bytes/cluster)
MBR type: 11
bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=63 hds=16 hid=0 bsec=1953525168 bspf=1904021 rdcl=2 infs=1 bkbs=2
tk#
tk# mount /dev/wd1e /mnt
tk# df -h
Filesystem        Size       Used      Avail %Cap Mounted on
/dev/wd0a         146G        39G       100G  28% /
kernfs            1.0K       1.0K         0B 100% /kern
ptyfs             1.0K       1.0K         0B 100% /dev/pts
procfs            4.0K       4.0K         0B 100% /proc
/dev/wd1e         930G       4.0K       930G   0% /mnt
tk#

There are sometimes errors with the way files behave too, such as if a file is created on the FAT32 partition using NetBSD and then an attempt it made to duplicate it on the same partition in Windows this error appears (here "4GB" is the name of the file, actually it's 4GB.txt):

Error Copying File of Folder
Cannot copy 4GB: The file or directory is corrupted and unreadable.


Once when I tried to delete a file under Windows I'd made using NetBSD it's size became zero but it couldn't be deleted.

By the way, I'd read that the maximum size a file can have on a FAT32 partition is 4 GB but this doesn't seem to be so. I created a file of size 4GB on an ffs partition and tried to copy it to the FAT32 one using NetBSD but it failed:

tk# ls -l 4*
-rw-r--r--  1 ray  wheel  4294967296 May 14 15:03 4GB.txt
tk# /usr/bin/time cp 4GB.txt /mnt
cp: /mnt/4GB.txt: File too large
      103.19 real         0.04 user        20.67 sys
tk# ls -l /mnt
total 4194240
-rwxr-xr-x  1 root  wheel  4294901760 May 15 17:55 4GB.txt
tk#

Curiously, the eventual size of the copy was precisely 64K bytes less than the 4 GB original.


Ray


Home | Main Index | Thread Index | Old Index