Skip site navigation (1)Skip section navigation (2)
Date:      6 Mar 2005 16:56:03 -0500
From:      c3cookja@cdf.toronto.edu
To:        "Alejandro Pulver" <alejandro@varnet.biz>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Moving a slice
Message-ID:  <20050306215603.GA1945@werewolf.cdf.toronto.edu>
In-Reply-To: <20050306214734.GA21661@werewolf.cdf.toronto.edu>
References:  <20050306150319.49fddd98@ale.varnet.bsd> <20050306214734.GA21661@werewolf.cdf.toronto.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 06, 2005 at 04:47:34PM -0500, james.cook@utoronto.ca wrote:
> On Sun, Mar 06, 2005 at 03:03:19PM -0300, Alejandro Pulver wrote:
> > Hello,
> > 
> > I have two IDE hard disks, the first has W2K and WXP, the second has a
> > GNU/Linux Debian Sarge (for booting purposes only) and a FreeBSD 5.3.
> > 
> > The Linux slice is the number 1, but the FreeBSD slice is number 4.
> > There is a long story behind this, when I was looking for UNIX like
> > Operating Systems (I had two Linux and one Linux Swap slices, but I
> > removed them). At the end I choose FreeBSD.
> > 
> > Here is my slice layout:
> > 
> > # fdisk -s
> > /dev/ad2: 79656 cyl 16 hd 63 sec
> > Part        Start        Size Type Flags
> >    1:          63    20466747 0x83 0x00
> >    4:    40949685    38909430 0xa5 0x80
> > 
> > # fdisk
> > ******* Working on device /dev/ad2 *******
> > parameters extracted from in-core disklabel are:
> > cylinders=79656 heads=16 sectors/track=63 (1008 blks/cyl)
> > 
> > Figures below won't work with BIOS for partitions not in cyl 1
> > parameters to be used for BIOS calculations are:
> > cylinders=79656 heads=16 sectors/track=63 (1008 blks/cyl)
> > 
> > Media sector size is 512
> > Warning: BIOS sector numbering starts with sector 1
> > Information from DOS bootblock is:
> > The data for partition 1 is:
> > sysid 131 (0x83),(Linux native)
> >     start 63, size 20466747 (9993 Meg), flag 0
> > 	beg: cyl 0/ head 1/ sector 1;
> > 	end: cyl 1023/ head 254/ sector 63
> > The data for partition 2 is:
> > <UNUSED>
> > The data for partition 3 is:
> > <UNUSED>
> > The data for partition 4 is:
> > sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
> >     start 40949685, size 38909430 (18998 Meg), flag 80 (active)
> > 	beg: cyl 1023/ head 0/ sector 1;
> > 	end: cyl 1023/ head 254/ sector 63
> > 
> > There is a lot of free space after and before FreeBSD slice.
> > 
> > I would like to know if is possible to move the entire FreeBSD slice
> > (with 'dd', for example) to the end of the Linux slice, and then
> > change the starting point in the slice table, and then change '4' into
> > '2'. So there is no free space between the slices and the numbering is
> > correct.
> > 
> > I think 'dd' will not overrite some parts of the slice with others
> > because it is copying the data backwards, not forward.
> > 
> > Just for curiousity: Can I make 'dd' copy the data backwards (I mean,
> > the same result but instead of copying 1 to <dst>, 2 to <dst>+1,
> > etc.; copies <last> to <dst>, <last>-1 to <dst>+1, etc.)? Is possible to
> > make such modification to 'dd'? I plan to use this to move a slice
> > forward.
> > 
> > I guess I will have to use a bootable CD to boot a FreeBSD system (like
> > FreeSBIE) to move the slice.
> > 
> > Here are my results in bytes to pass to 'dd' (are they correct?):
> > 
> > Part	Start			Size
> > 1:	32256			10478974464 (9993 Meg)
> > 4:	20966238720 (19994 Meg)	19921628160 (18998 Meg)
> > 
> > What does the line "Warning: BIOS sector numbering starts with sector 1"
> > mean? It is an error?
> > 
> > Does the filesystem has to do with the phisical location of the slice
> > (according to the BSD label I think is does not, because it uses
> > offsets, not absolute values)?
> > 
> > Do I have to modify other file than '/etc/fstab' (like a loader
> > configuration file)?
> > 
> > I appreciate any recommendations/considerations/instructions/warnings.
> > 
> > Thanks and Best Regards,
> > Ale
> 
> I moved a FreeBSD slice from the end of my hard disk to somewhere close to
> the beginning a month or so ago, using nothing but dd, and it worked.
> 
> Please note that the original space occupied by the slice and the place I
> moved it to did not overlap at all, so I have no idea if you'll run into
> problems when you overwrite the start of it.  It would probably work, but if
> you have to start over for some reason, you're sunk -- and you'd need some
> sort of boot media to get it to work..  Maybe you can copy it one partition at
> a time?
> 
> Also, beware that the FreeBSD disklabel seems to use absolute offsets instead
> of relative offsets.  If you copy the whole slice at once, something like
> 
> # bsdlabel /dev/{old slice} > /tmp/text-label
> # bsdlabel -R /dev/{new slice} /tmp/text-label
> 
> should work, since the human-readable output uses relative offsets.  (But
> beware; I'm just working from memory here and haven't tested those commands at
> all.)
> 
> If you copy the data one partition at a time (as I ended up doing for some
> reason) it's a bit more complicated: you have to set up the disklabel before
> you start, but then when you copy partition a, the label will be messed up
> (assuming partition a starts at the beginning of the slice).  I just fixed the
> label again after copying partition a, and it seemed to work, but I can't
> guarantee that the system won't re-read the label while dd is working and
> decide that the destination partition is suddenly somewhere else and kill your
> original slice.
> 
> Er, just sharing my experience.  You might want to wait for furthur guidance,
> since all this is pretty messy.
> 
> - James Cook
>   james.cook@utoronto.ca

Oh, I just realized one thing:  if you copy it one partition at a time, the
old disklabel will get overwritten when you're partway done, so you'll be
copying data from the wrong place from then on.  Maybe you're best off dumping
and restoring; this is risky enough that you should back up anyway.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050306215603.GA1945>