Date: Wed, 14 May 2003 10:38:25 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Teilhard Knight <teilhk@Phreaker.net> Cc: FreeBSD <freebsd-questions@freebsd.org> Subject: Re: About my problem Message-ID: <20030514093825.GB64005@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <1052896702.3300.17.camel@arlette.love.dad> References: <1052896702.3300.17.camel@arlette.love.dad>
next in thread | previous in thread | raw e-mail | index | archive | help
--ftEhullJWpWg/VHq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 14, 2003 at 02:18:22AM -0500, Teilhard Knight wrote: > For those who do not know what I am talking about, this is what is > happening to me: >=20 >=20 > I have compiled my kernel. Everything seems to be all right,=20 > except that on boot it cannot mount root. >=20 > It displays: "mounting root from ufs:ad2s2a", and a failure message. >=20 > Now, I am left at boot with an inquire for a manual root filesystem > specification., like this: >=20 > <fstype><device> mount <device> using filesystem <fstype> >=20 > eg. ufs:/dev/da0s1a >=20 > ? List valid disk boot devices >=20 > <empty line> abort manual imput >=20 > mountroot> >=20 >=20 > The HD where FreeBSD is installed is ad2 in my previous kernel and in > this new one it is ad1. I have now found out that this is the source of > the problem. I checked the partition table, and the slices are called > ad2s2a ---> ad2s2g. If this is the case, no way I can mount root on a > disk called ad1 with those slices. >=20 > So, I'll pose a different question. Do you know of a possible way I can > make my new kernel to spot my HD as ad2? To me this is the only solution > possible. Hmmm... It's not impossible to recover from the situation you're in without having to do anything unaesthetic, like re-installing. It is, however, fairly tricky and requires use of some quite unfriendly commands. Your aim is simply to edit /etc/fstab and change all references to ad2 over to ad1. Since the fstab is not correct for your current machine, you can't boot to multiuser mode. You can, however, boot to single user mode with the root partition you tell the kernel as above. After power-on, interrupt the 10 second count down, and at the boot loader prompt type: set root_disk_unit=3D1 boot /kernel -s This should get you to the single user prompt, but with the root partition mounted read-only. In order to remount the root partition read-write, you need to do two things. First, run fsck(8) to clean up the file system and then run mount(8). Catch22 is that both of those commands will use /etc/fstab as a database of filesystems to work on, unless you take care to avoid that. Assuming that your root partition is on /dev/ad1s1a, run: # fsck /dev/ad1s1a # mount -u -o rw -t ufs /dev/ad1s1a / (Basically, you need to supply all required arguments to mount(8), to stop it going to /etc/fstab to try and look them up.) Now you've got the root partition mounted read-write, you can edit the /etc/fstab file. The tricky bit is that you only have the commands in /bin available to do the editing with (assuming that you've used the usual /, /usr partition layout). That means that you now have to get down and dirty with ed(1) --- the Unix editor of last resort. This command was originally designed for use on a teletype printer, so it doesn't show you a listing of the whole file and let you navigate around it in a natural way. The command syntax is a bit intimidating to the uninitiated too. You can see the ed(1) man page at http://www.freebsd.org/cgi/man.cgi?query=3Ded&apropos=3D0&sektion=3D0&m= anpath=3DFreeBSD+4.7-stable&format=3Dhtml Try this: Nb. You type the lines marked '<--' in the ed session. # cd /etc # cp fstab fstab.bak # ed fstab 448 (--> ed outputs the size of the file her= e) (<-- hit return, to get the ? prompt) ? (--> ed output) ,s/ad2/ad1/g (<-- substitute 'ad1' for 'ad2' everywhe= re) ,w (<-- write out the changed file) 448 (--> ed tells you the modified file size) q (<-- quit ed) # cat fstab Check the new contents of the fstab file for sanity. If you're happy, then try and fsck and mount all your filesystems: # fsck -p # mount -a If that works satisfactorily, you're done, and you can just type # reboot and the system *should* come up smoothly. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --ftEhullJWpWg/VHq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE+wg6RdtESqEQa7a0RAmb7AJ9Sda7PEHX1+vUKU6M/z61sxQN3KQCfWLMa lIgFWE64bmvRofWKbG7Z6OY= =Jk2o -----END PGP SIGNATURE----- --ftEhullJWpWg/VHq--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030514093825.GB64005>