# Fixing broken partition table on usb device [solved]

## Sedrik

Hi all

I have a usb device that has a broken partition table that I need to fix in order to be able to mount it in Linux again.

This is what I get when I run fdisk on it.

```
Dunderklumpen sedrik # fdisk /dev/sda 

Command (m for help): p

Disk /dev/sda: 511 MB, 511705088 bytes

16 heads, 61 sectors/track, 1024 cylinders

Units = cylinders of 976 * 512 = 499712 bytes

This doesn't look like a partition table

Probably you selected the wrong device.

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   ?      797271     1966850   570754815+  72  Unknown

Partition 1 has different physical/logical beginnings (non-Linux?):

     phys=(357, 116, 40) logical=(797270, 6, 23)

Partition 1 has different physical/logical endings:

     phys=(357, 32, 45) logical=(1966849, 14, 61)

Partition 1 does not end on cylinder boundary.

/dev/sda2   ?      172838     2156474   968014120   65  Novell Netware 386

Partition 2 has different physical/logical beginnings (non-Linux?):

     phys=(288, 115, 43) logical=(172837, 10, 1)

Partition 2 has different physical/logical endings:

     phys=(367, 114, 50) logical=(2156473, 1, 53)

Partition 2 does not end on cylinder boundary.

/dev/sda3   ?     1915863     3899498   968014096   79  Unknown

Partition 3 has different physical/logical beginnings (non-Linux?):

     phys=(366, 32, 33) logical=(1915862, 2, 32)

Partition 3 has different physical/logical endings:

     phys=(357, 32, 43) logical=(3899497, 9, 36)

Partition 3 does not end on cylinder boundary.

/dev/sda4   ?           1     3726667  1818613248    d  Unknown

Partition 4 has different physical/logical beginnings (non-Linux?):

     phys=(372, 97, 50) logical=(0, 0, 1)

Partition 4 has different physical/logical endings:

     phys=(0, 10, 0) logical=(3726666, 7, 53)

Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

Command (m for help): q
```

I believe Vista is the bad part in this story. How can I repair it? I need it to be FAT32.

BTW: the device works fine in vista and xp but in linux I can't see the partition on it.

----------

## mattsteven

Do you have any interesting messages in 'dmesg' when you insert this usb stick?  If so you might not have quite the right driver loaded for it.

If it seems OK, of course make a backup first.

Then start up fdisk, type "x" and then "f" to fix the partition order.   Then "w" to write it out and exit.

If that fails, use "o" to create a new bootlabel, save that and reboot to windows to fdisk and format it.  You can fdisk/format in linux too, just have to look up mkfs.vfat for the details as I don't remember offhand what they are.

----------

## eccerr0r

does this drive have anything valuable on it?

do you have the original partition table?

You could also zero out the partition table/disk and start over from scratch... not sure what you want to do with this drive?

----------

## Sedrik

dmesg says nothing funny really.

```
scsi 0:0:0:0: Direct-Access     DS-Xtrem e                     PQ: 0 ANSI: 0

SCSI device sda: 999424 512-byte hdwr sectors (512 MB)

sda: Write Protect is off

sda: Mode Sense: 33 00 00 00

sda: assuming drive cache: write through

SCSI device sda: 999424 512-byte hdwr sectors (512 MB)

sda: Write Protect is off

sda: Mode Sense: 33 00 00 00

sda: assuming drive cache: write through

 sda: unknown partition table

sd 0:0:0:0: Attached scsi removable disk sda

usb-storage: device scan complete
```

Edit*

I tried to fix the partition table with fdisk and the problem didn't go away  :Sad: 

I don't mind ressetting the disk. I have everything on it backed up. =)

----------

## Sedrik

Anyone that could walk me through this?

NVM..

made a new partition table with fdisk using the o command and then made a new partition with type (d I believe) W95 FAT32 (is that the correct one?)

Now when I try to mount the partition (after making it with mkfs.vfat -F 32 /dev/sda1) I get this

```
Unable to load NLS charset cp437

FAT: codepage cp437 not found
```

Solution.

The cp437 was a kernel module that had to be supported. now it works just fine  :Smile: 

----------

