3

I have an external (USB) disk, which has been working OK for some time and shows no errors whatsoever in /var/log/$relevantfiles (no errors on reading/writing, for example).

Here's the thing:

if I ask for sudo fdisk -l /dev/sda this returns:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x24796452

Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63  1953520064   976760001   83  Linux

which is exactly how I did it.

Now, I want to recover a partition in this disk to use for some other purposes, which require hfs, instead of ext{2,3,4}. So I turned myself to the old dear parted to resize the partition and create a new one.

Asking parted this returns:

(parted) print                                                            
Model: ST310005 28AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: mac

Number  Start  End    Size    File system  Name            Flags
1      512B   1535B  1024B                partition map
2      368MB  371MB  2982kB               OneClick-Ready

and if I run gparted I see all the empty space, and I cannot resize my partition, since it's not there.

Any pointers how to fix this things? I've never seen anything like it. The whole thing's running on a raspberry pi, using raspbian.

Thanks!

2
  • 1
    I saw a comment here (or perhaps at serverfault.com) recently stating that fdisk sometimes creates partitions that aren't quite kosher, which the more strict gparted doesn't recognize. Search for that at this site.
    – vonbrand
    Commented Feb 27, 2013 at 14:04
  • I will, thanks. If this is the case, that's definitely very annoying. They might not be kosher, but the kernel's pretty happy with them! :D Thanks!
    – mgm
    Commented Feb 27, 2013 at 14:08

1 Answer 1

3

You appear to have both a dos and mac partition table on the disk, and parted is recognizing the mac one. You should be able to zap the mac partition table with:

sudo dd if=/dev/zero count=1 bs=2 of=/dev/sda
5
  • would this render the data on disk unusable? Thanks
    – mgm
    Commented Feb 27, 2013 at 22:52
  • @mag, no, it will just remove the mac partition table leaving the dos one intact.
    – psusi
    Commented Feb 27, 2013 at 22:56
  • I'll try. Thanks :) (dd is a powerful thing, always a little scared when if=/dev/zero)
    – mgm
    Commented Feb 27, 2013 at 23:11
  • Hey, I just tried, now parted returns the whole space unallocated (no valid partition map found), but fdisk it's happy nonetheless....
    – mgm
    Commented Feb 27, 2013 at 23:15
  • @mag, looks like the first two bytes contain the mac magic number and that's what parted goes on to decide it's a mac label. MBR treats that space as executable code and ignores it. dd if=/dev/zero bs=2 count=1 of=/dev/sda should do the trick.
    – psusi
    Commented Feb 28, 2013 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .