From owner-freebsd-questions@FreeBSD.ORG Thu Feb 4 07:52:42 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91E57106566C for ; Thu, 4 Feb 2010 07:52:42 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id B3F438FC13 for ; Thu, 4 Feb 2010 07:52:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id o147qdgP020539; Thu, 4 Feb 2010 18:52:39 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Thu, 4 Feb 2010 18:52:39 +1100 (EST) From: Ian Smith To: Steve Franks In-Reply-To: <20100203182707.785BD10656AC@hub.freebsd.org> Message-ID: <20100204171740.B46992@sola.nimnet.asn.au> References: <20100203182707.785BD10656AC@hub.freebsd.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-180372837-1265269959=:46992" Cc: Jerry McAllister , freebsd-questions@freebsd.org Subject: Re: can't make an 'a' slice except with auto-defaults X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 07:52:42 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-180372837-1265269959=:46992 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT In freebsd-questions Digest, Vol 296, Issue 6, Message: 20 On Wed, 3 Feb 2010 10:26:06 -0700 Steve Franks wrote: > On Wed, Feb 3, 2010 at 8:18 AM, Jerry McAllister wrote: > > On Tue, Feb 02, 2010 at 07:59:15PM -0700, Steve Franks wrote: > > > >> On a running system.  I mean, I know I should quit being a &%^#& and > >> read the manpage for bsdlabel, but sysintall really does have a nice > >> tui.    'C'reate slice goes straight to 'd', even on a 'fresh' disk. sysinstall (or sade) will assign 'd' to the first partition if its mount point for the partition is not specified as '/'. This is usually right, when partitioning either another slice on the same disk, or a slice on another disk, where '/' is already assigned to the booted disk. In the case of what you're doing, ie preparing another disk to copy your system to, it's not hard to fix that later with bsdlabel -e, as Jerry has pointed out, and which I'll detail further below. > >> I see in the handbook, this is alluded to, but some intermediate level > >> between begginer and expert (bsdlabel just strikes me as way too easy > >> to trash the disk I'm running off of while trying to make a backup), > >> would be nice...512M just won't fit the kernel+symbols. A default 1GB '/' is on the cards, perhaps by 8.1, but in any case I've never used anything like the autodefaults for other partitions either. bsdlabel(8) is not so scary. For one thing, anything you do is shown but not committed to disk if you use the -n switch. Try it. Also, the man has examples of saving and restoring an existing label, so if you: # bsdlabel ad1s1 > saved.ad1s1.label then if you stuff it up you can later on just restore it with: # bsdlabel -R ad1s1 saved.ad1s1.label > >> > > > > Well, Create slice would be an fdisk(8) thing, not bsdlabel. > > bsdlabel creates partitions within a slice. > > > > But, generally you cannot run fdisk on a disk that is in use on a > > running system - which generally means that it is the boot device, > > has filesystems mounted or has part of the currently designated swap > > space.  You will need to plug in a boot cd or bring up the fixit system > > for that.   The fixit system runs from memory - creates filesystems > > and mount points in memory rather than on disk, so it can talk to > > any disk. If you set kern.geom.debugflags=16 and 'w'rite from either sysinstall's fdisk or bsdlabel screens you can update the partition table or your new slice's bsdlabel, but you have to be very careful, and in the case of fdisk, you need to reboot before labeling the new slice. Certainly using a fixit boot is the safe and sure way to avoid complications. > > New, if you are working on a non-used (extra) disk, eg one that is not > > the boot device nor has any mounted filesystems or swap space > > on it, then you should be able to fdisk and bsdlabel that from > > a running system. This seems to be Steve's case, but he's right; it will start creating new partitions as 'd' rather than 'a' (since there's already a '/') unless he boots into either sysinstall or fixit from another source. > > I have no idea what you mean by "'C'reate slice goes straight to 'd'" > > It does not match anything I remember being possible.  I don't happen > > to have any system handy at the moment that I can muck with disks on. > > > > ////jerry I've several times added partitions to extra slice/s on either the boot disk or added disks (including sliced USB flash disks) using sysinstall invoked from the running system, and these do start with 'd' partition. > Ok, terminology crash. As someone pointed out, I'm talking about > label, here, not fdisk, and partitions, not slices (had those two > backwards in my head). > > Basically, as far as I can tell, on a running system, there is no > combination of keystrokes in sysinstall's label editor that will > create an "ad[1-9]s1a", except the 'a' key which produces a 512M s1a. The 'a' key auto-assigns '/' as the mount point for partition 'a', which is why you see that. You wouldn't be able to commit that anyway, as /, /var, /usr would conflict with your already mounted slice, and newfs'ing your existing system is most likely not what you want :) > All other keystrokes (namely 'c') go straight to "ad[1-9]s1d" when a > second disk is placed in a system booted from ad0s1a. I'm just trying > to make a fresh disk ready for dump/restore with a 1G /, so I guess > sysinstall is out as an option at this time. You may be better off just installing the new system onto ad1 straight up, ignoring your ad0, when you can just use sysinstall. However .. sysinstall (or sade) run from an existing system is a pretty convenient way to partition a disk, or slice. You don't really need to worry about it starting at 'd', as you can easily correct that later. Eg this one: smithi on sola% fdisk -s ad0 /dev/ad0: 77520 cyl 16 hd 63 sec Part Start Size Type Flags 1: 30240 8346240 0x0c 0x00 # DOS 2: 8376480 50319360 0xa5 0x80 # freebsd boot slice 3: 63 15057 0x12 0x00 # compaq diagnostics 4: 58695840 19444320 0xa5 0x00 # freebsd data/backup smithi on sola% bsdlabel ad0s2 # /dev/ad0s2: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 524288 0 4.2BSD 0 0 0 b: 786432 524288 swap c: 50319360 0 unused 0 0 # "raw" part, don't edit d: 524288 1310720 4.2BSD 0 0 0 e: 48484352 1835008 4.2BSD 0 0 0 smithi on sola% bsdlabel ad0s4 # /dev/ad0s4: 8 partitions: # size offset fstype [fsize bsize bps/cpg] c: 19444320 0 unused 0 0 # "raw" part, don't edit d: 262144 0 4.2BSD 2048 16384 16392 e: 524288 262144 4.2BSD 2048 16384 32776 f: 18657888 786432 4.2BSD 2048 16384 28552 So if I wanted to, I could just a) save bsdlabel ad0s4 output to a file (to be safe); b) run bsdlabel -e -n ad0s4 and change the d: to a: (to be paranoid and check what it would write without -n), then c) run bsdlabel -e ad0s4 and edit d: to a: (to get it done :) Alternatively, I could edit d: to a: in the saved text label, and then just 'bsdlabel -R ad0s4 $savedlabel' .. same goes for you with ad1s1. Could also move e: to d: and f: to e: though I don't think it matters. When you install 8.0 for real, you'd specify '/' and other mount points. I still think installing 8.0 first, clean, may be your best bet; then use dump and restore (and/or cp -p and/or tar) to move non-system data. cheers, Ian --0-180372837-1265269959=:46992--