2011-06-18 01:17:40

by Paul Bolle

[permalink] [raw]
Subject: Re: [Bugme-new] [Bug 37682] New: Kernel mis-detects size/position of partition created with Seagate DiscWizard (OnTrack Disk Manager)

On Sat, 2011-06-18 at 03:01 +0200, Paul Bolle wrote:
> nor could I find the commit(s) that removed it.

That was 232595eaff951e96cabe5e85fed35f66b72ff51e ("ide: remove
obsoleted "hdx=" kernel parameters"), which was applied in the v2.6.27
cycle.


Paul Bolle


2011-06-18 09:33:11

by Mark Knibbs

[permalink] [raw]
Subject: Re: [Bug 37682] New: Kernel mis-detects size/position of partition created with Seagate DiscWizard (OnTrack Disk Manager)

Hi,

Paul Bolle wrote:
> On Sat, 2011-06-18 at 03:01 +0200, Paul Bolle wrote:
>> nor could I find the commit(s) that removed it.
>
> That was 232595eaff951e96cabe5e85fed35f66b72ff51e ("ide: remove
> obsoleted "hdx=" kernel parameters"), which was applied in the v2.6.27
> cycle.

Was the feature which that commit removed specific to ide devices? That
is, would it have not applied for a drive connected via a USB/Firewire
bridge?

Ideally the kernel partition-scanning code would be fixed to handle these
strange partitions. As a temporary measure, it might be best to print a
warning and not create the incorrect block device.

E.g. user might think "I'll back up this partition"
dd if=/dev/sdc1 of=partition.bin
or "I'll wipe this partition before disposing of the disk"
dd if=/dev/zero of=/dev/sdc1.
Neither has the desired effect.


Mark

2011-06-18 10:38:28

by Paul Bolle

[permalink] [raw]
Subject: Re: [Bug 37682] New: Kernel mis-detects size/position of partition created with Seagate DiscWizard (OnTrack Disk Manager)

On Sat, 2011-06-18 at 09:51 +0100, [email protected] wrote:
> Paul Bolle wrote:
> > That was 232595eaff951e96cabe5e85fed35f66b72ff51e ("ide: remove
> > obsoleted "hdx=" kernel parameters"), which was applied in the v2.6.27
> > cycle.
>
> Was the feature which that commit removed specific to ide devices? That
> is, would it have not applied for a drive connected via a USB/Firewire
> bridge?

I have no clue. I'd guess it wouldn't. For instance, a drive connected
using USB uses the SCSI layer, doesn't it? That wasn't different a few
years ago.

> Ideally the kernel partition-scanning code would be fixed to handle these
> strange partitions. As a temporary measure, it might be best to print a
> warning and not create the incorrect block device.
>
> E.g. user might think "I'll back up this partition"
> dd if=/dev/sdc1 of=partition.bin
> or "I'll wipe this partition before disposing of the disk"
> dd if=/dev/zero of=/dev/sdc1.
> Neither has the desired effect.

Digging further into this I found commit d708c40d ("ide: mark
"hdx=remap" and "hdx=remap63" kernel parameters as obsoleted"). The
commit message reads:
Mark "hdx=remap" and "hdx=remap63" kernel parameters as obsoleted
(they are layering violation and should be dealt with in the same
way as done by libata - device-mapper should be used instead).

Perhaps this means one is expected to use dmsetup(8) for this. I have
never configured device-mapper at that level by hand. man 8 dmsetup is
over 300 lines of (new for me) information. Without a disk like yours at
hand, it's hard to say whether device-mapper allows to do stuff like
this (ie, remapping an entire drive by 63 sectors) by hand.

Of course, for your particular drive it might be easier to just dd the
actual partition (so skipping 63 sectors) into new file (a 20G image) on
another drive. That image should be loop mountable. If that's correct
you could then do with the drive as you please. Given its age, it may be
wise to, say, shred(1) its corresponding device and drop the drive at
your local recycling site.


Paul Bolle

2011-06-18 14:35:47

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [Bug 37682] New: Kernel mis-detects size/position of partition created with Seagate DiscWizard (OnTrack Disk Manager)

On Saturday 18 June 2011 12:38:21 Paul Bolle wrote:
> Perhaps this means one is expected to use dmsetup(8) for this. I have
> never configured device-mapper at that level by hand. man 8 dmsetup is
> over 300 lines of (new for me) information. Without a disk like yours at
> hand, it's hard to say whether device-mapper allows to do stuff like
> this (ie, remapping an entire drive by 63 sectors) by hand.
>
> Of course, for your particular drive it might be easier to just dd the
> actual partition (so skipping 63 sectors) into new file (a 20G image) on
> another drive. That image should be loop mountable. If that's correct
> you could then do with the drive as you please. Given its age, it may be
> wise to, say, shred(1) its corresponding device and drop the drive at
> your local recycling site.

You can also create a "correct" partition table to replace the old
one and directly point to the FAT partition:

# fdisk -c -u -C2435 -H255 -S 63 /dev/sdX

Command (m for help): p

Disk /dev/sdX: 0 MB, 0 bytes
255 heads, 63 sectors/track, 2434 cylinders, total 0 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: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdX * 9 16434494 8217243 54 OnTrackDM6

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (1-39118274, default 1): ?
First sector (1-39118274, default 1): 126
Last sector, +sectors or +size{K,M,G} (126-39118274, default 39118274): +39102147

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

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: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdX * 126 39102273 19551074 c W95 FAT32 (LBA)


Command (m for help): w
The partition table has been altered!


WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.