Date: 8 Mar 2005 14:21:35 -0500 From: james.cook@utoronto.ca To: "Alejandro Pulver" <alejandro@varnet.biz> Cc: freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: Moving a slice Message-ID: <20050308192135.GB17351@skywolf.cdf.toronto.edu> In-Reply-To: <20050306194807.0d303236@ale.varnet.bsd> References: <20050306150319.49fddd98@ale.varnet.bsd> <20050306214734.GA21661@werewolf.cdf.toronto.edu> <20050306194807.0d303236@ale.varnet.bsd>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050308192135.GB17351>