# GPT problem on external USB HD



## Plume (Jun 24, 2011)

Hi

I was running FreeBSD 5.4 on a Compaq Evo N800c for a while now and I installed 7.4.

This box was mainly used as print server, web server, fax server and multimedia -mainly music- server.
No luck for fax server as winmodems are not recognized anymore and no luck with cups/HPlip neither.

But my problem now is that my USB external hard drive which contains my music gives me some strange error messages about some GPT stuff. When I look up on the internet, all information I can find is related to some hard drive mirroring (RAID) which I do not use, it's just an UFS data (music) external disk.

I probably UFS-formatted it wrongly using sysinstall and now I have lots of difficulties to mount it.
Why does "GPT" manage my disk?

This is what I get when I attach it:

```
umass0: <JMicron USB to ATA/ATAPI Bridge, class 0/0, rev 2.00/1.00, addr 2> on uhub2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SAMSUNG HD321KJ > Fixed Direct Access SCSI-2 device 
da0: 40.000MB/s transfers
da0: 305245MB (625142448 512 byte sectors: 255H 63S/T 38913C)
GEOM: da0: the primary GPT table is corrupt or invalid.
GEOM: da0: using the secondary instead -- recovery strongly advised.
```

In /dev, I have sometimes (when fresh reboot):

```
da0     da0p1   da0p2   da0s1   da0s1a  da0s1c
```
and sometimes, only (when I attach the HD):

```
da0     da0s1   da0s1a  da0s1c
```

This is what I get when I GPT recover it :

```
[root@evo /]# gpt recover /dev/da0p1
gpt recover: /dev/da0p1: error: device contains a MBR
[root@evo /]# gpt recover /dev/da0p2
gpt recover: unable to open device '/dev/da0p2': No such file or directory
[root@evo /]# gpt recover /dev/da0  
gpt recover: /dev/da0: error: device contains a MBR
[root@evo /]# gpt recover /dev/da0p1
gpt recover: /dev/da0p1: error: device contains a MBR
[root@evo /]# gpt recover /dev/da0p2
gpt recover: unable to open device '/dev/da0p2': No such file or directory
[root@evo /]# gpt recover /dev/da0s1a
gpt recover: /dev/da0s1a: no primary or secondary GPT headers, can't recover
[root@evo /]# gpt recover /dev/da0s1c
gpt recover: error: bogus map
gpt recover: unable to open device '/dev/da0s1c': No such file or directory
```

This is what I get when I *fsck* it (but most of the time, it's marked as unclean and RERUN FSCK):

```
[root@evo /]# fsck /dev/da0s1a
** /dev/da0s1a
** Last Mounted on /mnt/dd300
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
10501 files, 27912574 used, 123452169 free (329 frags, 15431480 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED CLEAN *****
```

This is what I get when I mount it:
Ok, this time it was ok (fresh reboot) but most of the time, I cannot.

Some help would be appreciated, thank you,

Marc


----------



## richardpl (Jun 24, 2011)

Plume said:
			
		

> No luck for fax server as winmodems are not recognized anymore and no luck with cups/HPlip neither.



Winmodems AFAIK were never supported on FreeBSD.

Can you give more info?

External USB hard disk was working fine with 5.4?

What file system is on that hard disk and how file system was formatted?


----------



## Plume (Jun 24, 2011)

> Winmodems AFAIK were never supported on FreeBSD.



On FreeBSD 5.4, comm/ltmdm port was not broken.



> Can you give more info?
> 
> External USB hard disk was working fine with 5.4?
> 
> What file system is on that hard disk and how file system was formatted?




```
[mpl@evo ~]$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/da0s1a    289G     53G    212G    20%    /mnt/dd300
[mpl@evo ~]$ mount
/dev/da0s1a on /mnt/dd300 (ufs, local)
```

I formated it using sysinstall, maybe that's where the root of my problem.


----------



## richardpl (Jun 24, 2011)

How did you partition it?

Maybe you bought it with gpt partition scheme which then got overwritten with mbr in 5.X days ...

I see you are using gpt command. gpt is long time deprecated and should not be on 8.X. You should use gpart (gpt is replaced with gpart).

So you were using old gpt binary from old 5.X installation. It is not going to work with new kernel.

I see you are using 7.4. gpt on 7.X is broken and should not be used at all.


----------



## Plume (Jun 24, 2011)

Thanks.

Actually, I don't know what's GPT; dmesg showed me GPT table broken, you should use recover, and I did use "GPT RECOVER".
So basically what should I do now? 

- Is GPT installed on my system? Do I have to "remove" it? Or would it be enough to reformat my whole drive?


----------



## richardpl (Jun 24, 2011)

If you can still recover all your data I would make backup of all files on that disk and clear first few sectors so that partition table get lost and would then recreate partition and file system and then put data back.


----------

