From owner-freebsd-questions@FreeBSD.ORG Sun Mar 6 22:47:29 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB95716A4CE for ; Sun, 6 Mar 2005 22:47:29 +0000 (GMT) Received: from relay.pair.com (relay00.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 4F21243D1D for ; Sun, 6 Mar 2005 22:47:29 +0000 (GMT) (envelope-from alejandro@varnet.biz) Received: (qmail 83033 invoked from network); 6 Mar 2005 22:47:27 -0000 Received: from unknown (HELO ale.varnet.bsd) (unknown) by unknown with SMTP; 6 Mar 2005 22:47:27 -0000 X-pair-Authenticated: 200.115.214.206 Date: Sun, 6 Mar 2005 19:48:07 -0300 From: Alejandro Pulver To: james.cook@utoronto.ca Message-ID: <20050306194807.0d303236@ale.varnet.bsd> In-Reply-To: <20050306214734.GA21661@werewolf.cdf.toronto.edu> References: <20050306150319.49fddd98@ale.varnet.bsd> <20050306214734.GA21661@werewolf.cdf.toronto.edu> X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; i386-portbld-freebsd5.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions Subject: Re: Moving a slice X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2005 22:47:30 -0000 On 6 Mar 2005 16:47:34 -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: > > > > The data for partition 3 is: > > > > 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 , 2 to > > +1, etc.; copies to , -1 to +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 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" Thank you for your reply. I only want to experiment (I can store all the data in my FreeBSD system to my first disk). Aren't Partition Magic and such programs so dangerous as 'dd' in this case? 'df' shows me the following: /dev/ad2s4f 16G 2.9G 12G 19% /usr Is it recommended to make '/usr' shorter (before moving) or it makes things more complicated (I mean, I will have to move all other partitions near '/usr', change BSD label, and revert the whole process after moving the slice)? I also think I can delete the swap partition (998 MB). Can growfs(8) make a partition shorter? If not, can this be done? How can I resize/create swap partitions? You mentioned copying the root partition will overrite the BSD label. So is the BSD label in the root partition? For my personal interest: Where can I find information about the phisical locations of the slice table, BSD label, and file system data(TOC, superblock, etc.; not files)? And the file system components? Is there a patch or something like that that allows 'dd' to perform the transfer from the end to the begining (to move partitions forward)? Thanks and Best Regards, Ale