# mounting a USB HDD



## hirohitosan (Dec 2, 2009)

I want to mount a USB HDD and I need some assistance from you guys.

I plug the USB HDD and 
	
	



```
> dmesg
ugen4.2: <Sunplus Technology Co.,Ltd.> at usbus4
umass0: <Bulk Only Interface> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SAMSUNG HD501LJ > Fixed Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 476940MB (976773168 512 byte sectors: 255H 63S/T 60801C)
```
I think my HDD is da0
At this point can I try to format it?

I went to Handbook > Adding Disks > Using Slices
I want to format the HDD in fat32 and since I'm not familiar with commands I need some help

```
# dd if=/dev/zero of=/dev/da0 bs=1k count=1
# fdisk -BI da0
# bsdlabel -B -w da0s1 auto
# bsdlabel -e da0s1
# mkdir -p /1
# newfs /dev/da0s1e
# mount /dev/da0s1e /1
```
are these commands suitable for my da0 HDD?
where in that commands should I specify to format in fat32?

thanks!


----------



## vivek (Dec 2, 2009)

> newfs /dev/da0s1e


This will format in ufs file system. Use newfs_msdos to create a new MS-DOS (FAT / FAT 32) file system. 

```
newfs_msdos /dev/ad1s1
```
Once formatted you can mount it:

```
mkdir /mnt/usb
mount -t msdos /dev/da1s1 /mnt/usb
```

Replace ad1s1 with actual device names.


----------



## hirohitosan (Dec 2, 2009)

Thanks! I did

```
# dd if=/dev/zero of=/dev/da0 bs=1k count=1
1+0 records in
1+0 records out
1024 bytes transferred in 0.000477 secs (2147484 bytes/sec)

# fdisk -BI da0
******* Working on device /dev/da0 *******
fdisk: invalid fdisk partition table found
fdisk: Class not found
```
what does it mean that? should I continue with
`# bsdlabel -B -w da1s1` ? or something is wrong?
I tried 
	
	



```
# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 976768002 (476937 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 384/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```
That means there are 4 partitions on HDD?


----------



## jb_fvwm2 (Dec 3, 2009)

You want the entire disk as fat32?
I would not advise it (limits on partition size)
Say it is 500g, you want the first partition 120G fat32
and the remainder ufs
make a file: say, da0.file

p 1 11 63 120G
p 2 165 * * 

Be sure any data on the target disk is backed up

Format the first 120 as Fat32 and the remainder 
as ufs2: 


(I've done this maybe 3 times total, so take
this as not *absolutely* error-free)




```
fdisk -f da0.file -v -u /dev/da0
```
Subsequently, you could bsdlabel and newfs the
second partition, later at your convenience.


----------



## none (Dec 6, 2009)

hirohitosan: you could use sysinstall. I confess I'm a bit lazy on learning how to fdisk (using FreeBSD fdisk) and bsdlabel disks. I always use sysinstall and no problem so far 

none


----------



## easymac (Dec 6, 2009)

You can also consider using the GUID Partition Table (GPT).  It supports greater partition sizes.  The issue is that I don't believe it's supported in Windows XP, only XP x64 and up.

If you're interested in using GPT, you should check out the man pages for gpart.


----------



## Beastie (Dec 6, 2009)

The commands vivek posted should be enough. *newfs_msdos* should create the FAT filesystem on *da0s1*.

An MBR has always 4 slices/BIOS partitions no matter what, even if you have a huge slice encompassing the entire disk.

bsdlabel reads/writes a *BSD* (UFS) label which is obviously useless for a *FAT* partition.

Also, did you notice you used *da0* with some commands and *da1* with other commands? Be careful with these or someday you'll end up wiping all your data out.


----------

