# Create MS/XP file system so it will be recognized on a XP system.



## fbsd1 (May 1, 2010)

*Create MS/Windows file system on a Hard Drive so it will be recognized on an 
MS/Windows system.​*
The goal here is to initialize a hard drive that was previous initialized with a 
non-Microsoft Windows file system, with a single active partition populated with Microsoft Windows 32 bit FAT (LBA) file system. So this hard drive will be recognized as containing a valid MS/Windows file system when used on a Microsoft Windows system.

I have an old IDE 3.5â€ hard drive with FBSD Release 7.0 on it. I want to use it as external USB attached disk on XP. 

All PCâ€™s running a MS/Windows system inspect sector 0 of the hard drive for the 
partition/slice table to determine the sysid of each partition/slice. If the sysid value is 12 then itâ€™s a valid Microsoft Windows file system and gets assigned a 
drive letter in â€œwindows explorerâ€. Any other sysid value means non-Microsoft Windows file system and the device is seen in 
â€œcontrol panel/system/hardware/devices/hard drivesâ€ as there but â€œwindows explorerâ€ does not assign a drive letter to it.

There are 2 ways to initialize ((2.5â€ or 3.5â€) (IDE or SATA)) hard drives with a 
valid MS/Windows file system. Using the Microsoft â€œfdiskâ€ program or the 
FreeBSD â€œfdiskâ€ program. The Microsoft â€œfdiskâ€ program defaults to sysid =12. 
The FreeBSD  â€œfdiskâ€ program defaults to sysid = 165, but has alternate way to 
assign any sysid value you want.

*Microsoft method.* Replace the 2.5â€ hard drive in your laptop with the 2.5â€ hard drive containing the FreeBSD system. If 3.5â€ hard drive then open your desktop PC, remove the data cable ribbon and power connection from the existing hard drive and attach them to the 3.5â€ hard drive containing the FreeBSD system. Put the Microsoft XP, Vista, or Windows7 install CD in the cdrom drive and boot. Select fdisk option from the install menu to populate the hard drive with official ntfs file system. No need to continue with the install after fdisk complete.

*FreeBSD method.* You need a PC with a running FreeBSD system and USB 
hardware to attach the 2.5â€ or 3.5â€ IDE or SATA hard drives with. A USB 
external hard drive housing will work fine for 3.5â€ IDE and SATA drives. 
For 2.5â€ IDE or SATA drives you will need a USB adapter cable. The 'CD-r king' 
hard drive to USB cable I purchased works with 2.5â€ & 3.5â€ IDE drives and 
SATA drives, cost $10 USA. If you have a 3.5â€ IDE or SATA hard drive and 
FreeBSD is running on a desktop PC, you could open it up and add it as a 
second hard drive on the data ribbon. 

Attach the hard drive to the USB equipment and plug into USB port on the 
PC running FreeBSD. Best if you are logged in as â€œrootâ€. You will see the 
USB console messages as the USB hard drive is connected. In most cases the 
USB drive will be assigned da0 as the device name. The following instructions 
are for initializing the hard drive as a single MS/Windows partition 
occupying the whole hard drive. 


 Wipe clean the sector 0 slice table

```
# dd if=/dev/zero of=/dev/da0 count=2
```


The following is what you would do if the initialized msdosfs hard drive 
will only be used on a FreeBSD system. The slice table is populated with 
the sysid of 165, which means FreeBSD is using this slice, but the slice 
contains a MSDOS FAT32 file system. The newfs_msdos command is really 
acting like the msdos format command. The larger your hard drive the longer 
this command will take to complete.


```
#fdisk -BI /dev/da0
#newfs_msdos -F32 /dev/da0s1
```

This creates the sector 0 slice table and loads the default bios boot code 
and activates a single slice covering the entire disk.


If at this point you un-plugged the USB cable from the FreeBSD system and 
plugged it into a Microsoft Windows PC. The USB drive would be un-accessible 
by â€œwindows explorerâ€ because no drive letter gets assigned. Thatâ€™s because 
Windowâ€™s sees this hard drive as a non-windows drive. Which is really true 
because the slice sysid contains the 165 value.


To make the hard drive accessible to a Microsoft Windows PC, the sysid has 
to be set to a value of 12. This time use the fdisk flag lower case â€œiâ€ which 
clears all existing slice entries and puts you in interactive slice table update mode.


```
# fdisk -Bi /dev/da0
```

Select default â€œnâ€ for everything except for the following prompts.

*Changing partition1 which you answer "y"*.

When prompt ( *Supply a decimal value for "sysid (165=FreeBSD)" [165]* ) 
enter the value of *12*. 

Then at prompt (*Are we happy with this entry? [n] *) enter value of *y* for yes. 

And at the end you get prompt (*Should we write new partition table? [n] *) 
enter value *y* for yes.



```
#fdisk /dev/da0
```

Will now show that partition 1 is marked active and has sysid of 12 for 
(DOS or Windows 95 with 32 bit FAT (LBA)).



```
# newfs_msdos -F32 /dev/da0s1
```

Will format the slice 1 partition for MSDOS file system. Elapse running time is 
dependant on hard disk size.

If at this point you un-plugged the USB cable from the FreeBSD system 
and plugged it into a Microsoft Windows PC. The USB drive would be accessible 
by â€œwindows explorerâ€ because a drive letter gets auto-assigned. Thatâ€™s 
because Windowâ€™s now sees this hard drive as a windows drive. Which is really 
true because the slice sysid contains the 12 value.


----------



## graudeejs (May 11, 2010)

AFAIK you can just `$ newfs_msdosfs /dev/da0` and it will work (at least works for me)


----------



## SirDice (May 11, 2010)

The filesystem is called FAT, not MS/XP. The default filesystem on an NT (this includes XP, Vista etc) system is NTFS. NTFS and FAT are quite different.


----------



## Carpetsmoker (May 14, 2010)

killasmurf86 said:
			
		

> AFAIK you can just `$ newfs_msdosfs /dev/da0` and it will work (at least works for me)



Indeed, by default Windows doesn't add a partition table to a hard drive. (But sometimes it does, it depends on the size IIRC. Typical "Windows magic" is involved.).



			
				SirDice said:
			
		

> The filesystem is called FAT, not MS/XP. The default filesystem on an NT (this includes XP, Vista etc) system is NTFS. NTFS and FAT are quite different.



The default filesystem for external drives is FAT32, not NTFS. IIRC the default for Windows 7 it's exFAT.
NTFS performance is terrible on USB drives.


----------



## SirDice (May 14, 2010)

Carpetsmoker said:
			
		

> NTFS performance is terrible on USB drives.


True. Not only that, you have a whole slew of ACL misery if you share that drive between systems. 

I was merely pointing out that there is no such thing as an XP filesystem


----------

