dd'ing a modified partition table to my /dev/ad0

run10kswim_at_directvinternet.com
Date: 12/31/04


Date: 30 Dec 2004 15:10:54 -0800

i started a thread on 27-dec re: "creating FB partitions within
ad0s9a/b/d/e/f/etc." please see:

http://groups-beta.google.com/group/comp.unix.bsd.freebsd.misc/browse_frm/thread/f043bbf9c36d7a17/7af556565aa6c3f5?_done=%2Fgroup%2Fcomp.unix.bsd.freebsd.misc%2Fthreads%3Fstart%3D30%26order%3Drecent%26&_doneTitle=Back&&d#7af556565aa6c3f5

Per Hedeland suggested that i try changing the disk type value within
the extended dos partition's partition table (the table specific to the
logical drive i want to partition) to A5 (freebsd). sounds like a
sensible (albeit nerve wracking) idea to me.

now PerH suggested that i employ a tool such as linux-fdisk (ports) to
do the dirty work. whenever i start linux-fdisk it warns me that i
"don't have write permission". that's fine. i figured i could just
use 'dd' to do the same thing. unfortunately, when i tried to do the dd
re-write i got an error which stated:

dd: /dev/ad0: Operation not permitted.

i'm by no means a 'dd' expert. i just assume that so long as i don't
give it a totally bogus set of command options that it'll just write
away, pleased as punch (hence the nerve wracking). may i use 'dd' to
write a sector to an system-related section of an exteded DOS partition
disk? the existing partiton identifier is 'b' (FAT32).

if you need more background info, let me briefly describe my
configuration & procedure.

# fdisk /dev/ad0

PARTITION INFO

partition id | starting sect | ending sect | id | Syst |
-------------------------------------------------------------------------------------------------------------
/dev/ad0s1 | 63 | 6763364 | a5 | freebsd |
....
/dev/ad0s9 | 71280468 | 80276804 | b | FAT32 |

from poking around with 'dd' i've noticed that the Extended Boot Record
(including the partition table stuff) actually begins 63 sectors AHEAD
of fdisk's diagnosed "starting sector" - at sector #71280405 (what
actually begins at ##68 must be the data). anyway, i recovered the
target sector as follows:

# dd if=/dev/ad0 skip=71280405 of=mypartitiondata

then i edited the binary file <mypartitiondata> with 'beav' (ports) to
change a single lousy value (at offset 1C2 Hex) from '0B' (FAT32) to
'A5' (FreeBSD). no problem. but then, when i tried to modify my disk:

# dd if=mypartitiondata of=/dev/ad0 oseek=71280405 conv=notrunc

i received that nasty "Operation not permitted" error.

am i just misusing 'dd'?
should i consider myself lucky that i didn't destroy my entire disk?
should i go back to trying to get 'linux-fdisk' to do the dirty work?
thanks and happy new year to all.

 - kenneth harwood



Relevant Pages

  • RE: Change Tracks Per Sector on system Partition
    ... mirroring system partitions of a cluster to an offsite SAN due to differing ... We cannot physically read the file system boot sector usually at ... If your software mirror a Windows NT/2000/2003 operating system partition ... another disk that is translated as 32spt, ...
    (microsoft.public.windows.server.setup)
  • RE: Change Tracks Per Sector on system Partition
    ... >Subject: RE: Change Tracks Per Sector on system Partition ... We cannot physically read the file system boot sector usually at ... >another disk that is translated as 32spt, ...
    (microsoft.public.windows.server.setup)
  • Re: Hard Drive Issues
    ... I'm assuming that particular sector on the drive is dying, ... Looks like you disk is on its way out, from the look of the above ... bsdlabel and newfs the new disk the way you want it. ... Ignore all the stuff above where it displays the partition information. ...
    (freebsd-questions)
  • Re: [opensuse] fdisk calculations
    ... I'm revising the partition HOWTO, ... Disk identifier: 0x04030201 ... The Cylinder / Head / Sector concept is an anachronism from the 1980's ... hard drives configured in the factory to have one alignment or the ...
    (SuSE)
  • Re: Setup problems - fdisk, overlapping sectors?
    ... Can we infer that the disk interface ... You use fdisk => meaning you have booted some kernel and are ... and readto read the second and the last sector of the disk. ... the disk had no extended partition. ...
    (comp.os.linux.setup)