Can't find kernel, finds slices but no files on them

Polytropon freebsd at edvax.de
Wed Sep 19 23:07:07 UTC 2012


On Thu, 20 Sep 2012 00:22:20 +0200, Fritiof Hedman wrote:
> On 19 September 2012 23:37, Polytropon <freebsd at edvax.de> wrote:
> > On Wed, 19 Sep 2012 23:28:30 +0200, Fritiof Hedman wrote:
> >> Hi list!
> >>
> >> I must warn you, I'm quite new to FreeBSD (I'm mostly using Linux
> >> otherwise). I have inherited an old (yes, very old) BSD 4.7 machine on
> >> my work that I need to clone. I've setuped an identical copy of the
> >> slices on the target machine, ran dump the source machine and restore
> >> on the target machine, edited /etc/fstab to match the filesystems. I'm
> >> also running the GENERIC-kernel, I've done this using the FreeSBIE
> >> live CD.
> >
> > What procedure did you use to clone? There basically is
> > the "one" way, using dump + restore on partitions (not
> > slices!), or dd on either partitions, slices, or the
> > whole disk.
> >
> 
> I maybe not so sure about the nomenclature that is used in FreeBSD.

The terminology is simple and as follows:

A disk is a disk, e. g. /dev/ad0.

A slice is a "DOS primary partition" on the disk, e. g. /dev/ad0s1.

A partition is a subdivision of a slice, e. g. /dev/ad0s1a.

Partitions can be used without a slice that encloses them,
e. g. /dev/ad0a; this is called "dedicated mode" (because
some obscure operating systems may have problems accessing
something they cannot even understand).

Tools like dump and restore operate on partitions.

Tools like dd operate on everything.



> However, I dumped /  on the source machine, and restored on /mnt/tmp
> on the source machine.

I assume you did dump and restore via network?

Like this?
http://www.wonkity.com/~wblock/docs/html/backup.html#_tt_dump_tt_via_ssh

Or this?
http://www.wonkity.com/~wblock/docs/html/backup.html#_copying_filesystems

Or did you have both disks in the same machine and transfer
from one disk to the other?

Anyway, if you have already reliably (!) confirmed that all
data is in the location they are supposed to be, your
copying procedure should have been fine.



> >> However, when I boot I get to BTX loader (so I guess boot0 and boot2
> >> is correct), that can't load kernel nor kernel.old. see attached
> >> img1.png .
> >
> > Images cannot be attached to list messages. :-(
> >
> 
> Oh, I see. It essentilally says something like:
> 
> BTX loader 1.00 BTX version is 1.01
> Console: internal video/keyboard
> BIOS drive A: is disk0
> BIOS drive C: is disk1
> BIOS 638kB/1046464kB available memory
> 
> FreeBSD/i386 bootstrap loader, Revision 0.8
> (root at builder.freebsdmall.com, Wed Oct 9 12:33:26 GMT 2002)
> \
> Hit [Enter] to boot immediately, or any other key for command prompt.
> Booting [kernel]
> can't load 'kernel'
> can't load 'kernel.old'
> 
> Type '?' for a list of commands, 'help' for more detailed help.
> ok ls
> open '/' failed: no such file or directory
> ok

Did you try "echo *" and "echo /boot/*" (and related important
directories) to make sure? Note that the "*" is _required_ in
this specific case.




> >> I can't ls, as the loader says there is no such file or
> >> directory (also seen in img1.png).
> >
> > You can use "echo *" in the loader stage, if I remember
> > correctly. Enter "?" for a list of the available loader
> > commands (or was it "help"?).
> >
> echo * just prints a pretty asterisk :)

I'm not sure if this is really the proper command at the "ok"
prompt (which is the state prior to loading the kernel); I
could shutdown my machine to check...

As I'm not very often sitting at the "low level prompts",
"Ok" and "boot:", I'm not really sure.



> It was more or less that way I did id,  the difference were that I
> mounted /usr under /, and not unmount each partition every time.

That's not required as long as your CWD within the hierarchy
for restoring is correct, and the mountpoints you want to
restore to are correctly accessible. For example, if you
missed to mount /mnt/usr to (let's say) /dev/ad1s1e (the
partition that would be /usr soon), stuff would go to the
wrong place.

Did you transfer a multi-partition system (typically /, /var,
/tmp, /usr and /home) or do you have everything in one big /
partition?



> I'm
> rerunning as the first document says that I should do (ie unmount the
> partition that I've just dumped and restored). I've  justed tested to
> do as described in the document, with the very same result.

You should not mount the partition you _dump from_ (even
though it's possible); only the partition you _restore to_
has to be (!) mounted. It doesn't basically matter _where_
it is mounted. As you could already locate the data at the
correct places, we can assume that you did everything correct.

To be sure, you could fsck the destination disks's partitions.
Make sure they are not mounted. That should be no problem from
a FreeSBIE disc (which I also consider a very good tool).



> Yeah, that's my guess as well. Maybe I should do the minimal install
> of the FreeBSD image first, boot into  a live mode and then restore
> everything upon the disks?

As a lazyness graduate, this is what I do (when I don't have
a scripted solution, e. g. for only _one_ use). :-)

Make sure you have set all the required boot code (fdisk and
bsdlabel), for example with the target disk already being in
its desired position. Note that you can add labels to avoid
trouble with device names.

Examples here:
http://www.wonkity.com/~wblock/docs/html/disksetup.html#_the_old_standard_way_tt_fdisk_8_tt_and_tt_bsdlabel_8_tt

And in The FreeBSD Handbook:
http://www.freebsd.org/doc/handbook/geom-glabel.html



> That would keep any boot flags on the disks
> right. But the thing that is annoying is that the loader can't browse
> the content of the disk. I guess that's the main issue here.

If you can use "lsdev" to properly identify your desired
boot device, you could try to directly boot the kernel:

	boot /dev/disk0s1a/boot/kernel/kernel

(if disk0s1a is the / partition of your installation).

That is what rootdev= should be set to in /boot/loader.conf,
if not the default.

You can find more information in The FreeBSD Handbook:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-blocks.html

And of course: "man 8 boot" as well as "man 8 loader" which
indicates that "ls" is the correct command, not "echo *" (which
must therefor be a correct command somewhere else). :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list