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

From: David Lord (snews_at_lordynet.demon.co.uk)
Date: 12/31/04


Date: Fri, 31 Dec 2004 01:05:04 +0000 (GMT)

On 30 Dec, in article
     <1104448254.893164.284600@z14g2000cwz.googlegroups.com>
     run10kswim@directvinternet.com wrote:

> /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.

I'd boot from a Linux rescue cd and change the partition type from
that. It's also possible to put in place a FreeBSD disklabel from
Linux fdisk but when I've tried it pre install of FreeBSD, I've
never found it to be accepted.

Although I don't know if this is possible, it could be worth trying
to make the existing FreeBSD slice overlap the extended partition
and then add the extra space using disklabel.

Third possibility, which I'm sure will work if done correctly is to
copy off the data from all the separate partitions, recreate the
partitions with the extra space added to the existing FreeBSD slice
and new FreeBSD disklabel as required then restore the data. The
relocated bootable partitions probably require reinitialising.
Depending on the existing logical partitions it might evenn be
possible to do this on or two partitions at a time as they are moved
towards end of the disk.

David

-- 
The Reply-To: is valid for at least 30 days after posting date
David Lord  - david@lordynet.demon.co.uk


Relevant Pages

  • Re: Partitioning for multiple systems
    ... and would like to add FreeBSD 7.2-RC2 as ... Presently I have three Master Boot Record primary partitions - "slices" ... A BSD slice subdivided into partitions that hold 8.0-CURRENT ...
    (freebsd-questions)
  • RE: Help me select hardware....Some real world data that might help
    ... Help me select hardware and software options for very large server ... and a couple other lists. ... MBR+UFS2 for operating system partitions ... I looked at "Large data storage in FreeBSD", but that seems to be a stale ...
    (freebsd-current)
  • Re: upgrade 7.2 overwrites partitions
    ... or at least the partitions were marked as ... Personally, I do think it's a pity, because FreeBSD (in my experience, since ... friendliest and most knowledgeable communities I know. ...
    (freebsd-questions)
  • Partitioning for multiple systems
    ... I have FreeBSD 8.0-CURRENT on it right now, and would like to add FreeBSD 7.2-RC2 as well as CentOS 5.3 Linux. ... Presently I have three Master Boot Record primary partitions - "slices" in the FreeBSD parlance, ... A BSD slice subdivided into partitions that hold 8.0-CURRENT ... A PC-style Master Boot Record can hold a maximum of four primary partitions, or it can hold three primaries and a single extended partition that is subdivided into logical partitions. ...
    (freebsd-questions)
  • Re: freebsd isntall, slices vs partitions, memory, booting ??
    ... > a little confused about what the freeBSD install is doing..i think it boots ... ``extended'' slices though. ... > divided into several more partitions to enable many partitions to be ...
    (comp.unix.bsd.freebsd.misc)