From owner-freebsd-questions@FreeBSD.ORG Tue Mar 8 19:21:36 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 97E5216A4CE for ; Tue, 8 Mar 2005 19:21:36 +0000 (GMT) Received: from smtp.cdf.toronto.edu (smtp.cdf.toronto.edu [128.100.31.106]) by mx1.FreeBSD.org (Postfix) with SMTP id BC8A543D53 for ; Tue, 8 Mar 2005 19:21:35 +0000 (GMT) (envelope-from c3cookja@cdf.toronto.edu) Received: (qmail 14496 invoked from network); 8 Mar 2005 19:21:35 -0000 Received: from skywolf.cdf.toronto.edu (qmailr@128.100.31.202) by penguin.cdf.toronto.edu with SMTP; 8 Mar 2005 19:21:35 -0000 Received: (qmail 26266 invoked by uid 4952); 8 Mar 2005 19:21:35 -0000 Date: 8 Mar 2005 14:21:35 -0500 Message-ID: <20050308192135.GB17351@skywolf.cdf.toronto.edu> From: james.cook@utoronto.ca To: "Alejandro Pulver" References: <20050306150319.49fddd98@ale.varnet.bsd> <20050306214734.GA21661@werewolf.cdf.toronto.edu> <20050306194807.0d303236@ale.varnet.bsd> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050306194807.0d303236@ale.varnet.bsd> User-Agent: Mutt/1.5.6i 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: Tue, 08 Mar 2005 19:21:36 -0000 On Sun, Mar 06, 2005 at 07:48:07PM -0300, Alejandro Pulver wrote: > On 6 Mar 2005 16:47:34 -0500 > james.cook@utoronto.ca wrote: > > 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 > > 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? I don't think there's currently any way to shorten a UFS filesystem. > How can I resize/create swap partitions? I don't think swap partitions have any particular format, so just create a partition of the appropriate size and swapon (man 8 swapon). If you want to resize one that's currently in use for some reason, be sure to swapoff the partition first. > You mentioned copying the root partition will overrite the BSD label. > So is the BSD label in the root partition? I'm pretty sure the BSD label is stored at the start of the disk, although I don't know of any documentation that says that. It's pretty much a guess. So, if your root partition covers the start of the slice, then it will include the disklabel as part of it. I guess the UFS2 filesytem knows about disklabels and can co-exist with them. Or I could be wrong about all this. I just know that when I copied /dev/ad0s4a to /dev/ad0s2a, I'm pretty sure I remember the disklabel got clobbered and I had to recreate it before going on to copy b, e, f and g. > 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? The slice table is common to all x86-style computers (referred to as the partition table outside of BSD land), so you can probably just search for "partition table" and find lots of info. I'm pretty sure it's stored somewhere in the first 512 bytes of your hard disk, though. I don't know any details about the bsd label, filesystem etc, but you can probably find info about it in the FreeBSD docs if you look... > 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)? Not that I know of, but I haven't looked... again, you're probably safest copying everywhere to some other medium and then copying it back once you're sure you've got a working backup. > Thanks and Best Regards, > Ale Sorry to be so vague about all this... I'm really not an expert about this sort of thing. But nobody else has replied, so... - James Cook james.cook@utoronto.ca P.S. The reply from "c3cookja@cdf.toronto.edu" is actually from me; I made a small mistake when I sent that.