Welcome to FreeBSDFreaks.net!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

simple boot question

 
   FreeBSD Hosting (Home) -> FreeBSD Handbook RSS
Next:  /var partition too small ... what to do ?  
Author Message
siliconmike

External


Since: Jul 26, 2005
Posts: 5



(Msg. 1) Posted: Tue Aug 16, 2005 5:41 pm
Post subject: simple boot question
Archived from groups: comp>unix>bsd>freebsd>misc (more info?)

Freebsd was installed on a disk on controller 0.

But now the disk is on controller 1.

Will it boot properly now if I choose controller 1 as the first boot
device in the bios ?

If no, what OS settings (eg. fstab??) do I need to change ?

[FreeBSD handbook told me that bios swapping is not recognized by
FreeBSD]

Mike

 >> Stay informed about: simple boot question 
Back to top
Login to vote
pachl

External


Since: Apr 30, 2005
Posts: 9



(Msg. 2) Posted: Wed Aug 17, 2005 1:54 am
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

siliconmike
> Freebsd was installed on a disk on controller 0.
>
> But now the disk is on controller 1.
>
> Will it boot properly now if I choose controller 1 as the first boot
> device in the bios ?

Why don't you try it? You'll get your answer very quickly that way.

I think I can tell you how this will go down. The BIOS will find the
disk's MBR (if your bios can boot the second controlloer) and the boot
sequence will begin. The kernel will probably load, but when it comes
time to mounting the file systems, you'll have problems if you have not
modified the fstab. The fstab will still be looking for partitions on
the first disk on the first controller (ad0, while you disk will be
named ad2 by FBSD). At this point, the mounting of / will fail, but you
will be given the chance to manually specify /'s location.

This is assuming you you are using the GENERIC kernel. I believe there
is a kernel option that deals with disk naming. GENERIC will name disks
according to position on the controller/bus. I beleive the alternative
(can't remember option's name) will assign names, ad[0-3], to disks as
they are discovered.

- pachl

 >> Stay informed about: simple boot question 
Back to top
Login to vote
siliconmike

External


Since: Jul 26, 2005
Posts: 5



(Msg. 3) Posted: Wed Aug 17, 2005 6:19 am
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

pachl wrote:
> siliconmike
> > Freebsd was installed on a disk on controller 0.
> >
> > But now the disk is on controller 1.
> >
> > Will it boot properly now if I choose controller 1 as the first boot
> > device in the bios ?
>
> Why don't you try it? You'll get your answer very quickly that way.

Its on remote host at hosting company who takes 72 hours to solve any
problem or request. So in case I run into problems trying to do this I
lose a week..ouch..

> I think I can tell you how this will go down. The BIOS will find the
> disk's MBR (if your bios can boot the second controlloer) and the boot
> sequence will begin. The kernel will probably load, but when it comes
> time to mounting the file systems, you'll have problems if you have not
> modified the fstab. The fstab will still be looking for partitions on
> the first disk on the first controller (ad0, while you disk will be
> named ad2 by FBSD). At this point, the mounting of / will fail, but you
> will be given the chance to manually specify /'s location.
>
> This is assuming you you are using the GENERIC kernel. I believe there
> is a kernel option that deals with disk naming. GENERIC will name disks
> according to position on the controller/bus. I beleive the alternative
> (can't remember option's name) will assign names, ad[0-3], to disks as
> they are discovered.

So you suggest, modifying the fstab successfully will solve the problem
? Are there other considerations ?
 >> Stay informed about: simple boot question 
Back to top
Login to vote
Matthew X. Economou

External


Since: Feb 28, 2005
Posts: 32



(Msg. 4) Posted: Wed Aug 17, 2005 2:34 pm
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>>>>> "siliconmike" == siliconmike writes:

siliconmike> If no, what OS settings (eg. fstab??) do I need to
siliconmike> change ?

If I recall correctly, the only thing you need to change is the device
names in /etc/fstab. You will probably have to boot into single user
mode to do it, that is to say, after you have made the physical
hardware change:

1. When booting FreeBSD, select option 4 at the "Welcome to FreeBSD!"
boot menu to boot into single user mode.

2. You will be prompted as to the location of your root file system.
For example, assuming your root file system was originally
/dev/ad0s1a and is now detected as /dev/ad2s1a, enter the
following:

ufs:ad2s1a

This prompt happens because FreeBSD reads /etc/fstab off the boot
volume to get the name of the root file system. (Unlike Linux, the
official FreeBSD distribution doesn't put the boot files on a
separate file system from the root file system.)

3. Just press return to start /bin/sh.

4. Remount the root file system read-write with the command:

mount -u -o rw /

5. If you do nothing else, you'll have to use ed to modify
/etc/fstab. For example, assuming your drive was originally
/dev/ad0 and is now detected as /dev/ad2, the following series of
commands will change /etc/fstab and save the changes to a new file
named /etc/fstab.new:

ed /etc/fstab
%s/ad0/ad2/g
w /etc/fstab.new
q

It is prudent to double-check your changes and backup your old copy
of /etc/fstab, just in case something goes horribly, horribly wrong.

6. Remount the root file system read-only with the command:

mount -u -o ro /

7. Reboot with the command:

reboot

Using ed is somewhat old-school, but if you want to use another
editor, you'll need to manually mount (and subsequently unmount) the
rest of your file systems (/usr, /var, etc.).

I tested this procedure in VMware just now, and it worked for me.
Good luck!

Best wishes,
matthew

--
jsoffron: I'm generally pretty high on national defense...
Mr. Bad Example: Careful...it's a gateway policy. Before you know it,
you'll be mainlining the hard stuff like trade agreements.
jsoffron: Too late...I've been freebasing Nafta all day... Sweet,
sweet NAFTA.
- As seen on Slashdot
 >> Stay informed about: simple boot question 
Back to top
Login to vote
pachl

External


Since: Apr 30, 2005
Posts: 9



(Msg. 5) Posted: Wed Aug 17, 2005 4:38 pm
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Matthew X. Economou
> If I recall correctly, the only thing you need to change is the device
> names in /etc/fstab. You will probably have to boot into single user
> mode to do it, that is to say, after you have made the physical
> hardware change:
Matthew's suggestion snipped.

siliconmike, if you can run in single user mode, I would try Matthew's
suggestion. How will you be getting into single user mode remotely?

Otherwise, here's what I would do remotely via ssh in multi-user mode:

1. # vi /etc/fstab (type the commands ``:%s/ad0/ad2/`` then ``:wq``)
2. # shutdown -h now
3. Call someone near the machine and tell them to turn off the machine,
move the drive from the master position on the first controller to the
master position on the second controller, and turn it back on.
4. As long as your BIOS loaded the boot loader on disk ad2, ultimately
loading the kernel, the kernel will now use the new fstab and mount the
partions normally. At this point you should be up and running.

I'm assuming you don't have any kind of boot manager, the disk is
dedicated to FreeBSD, and your BIOS will do what you want it to. I just
tried this on an old Pentium 1 test machine with Award BIOS and a
single system disk and it worked perfectly. You will have to figure out
how you will handle your BIOS or if it will do this for you
automatically.

BTW, why are you moving your disk? What will be on the first
controller?

Good luck,
Pachl
 >> Stay informed about: simple boot question 
Back to top
Login to vote
siliconmike

External


Since: Jul 26, 2005
Posts: 5



(Msg. 6) Posted: Wed Aug 17, 2005 7:31 pm
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Mathew and pachl, I cant thank you enough for the advise.

In fact I have 2 hard disks each with its own FreeBSD. (The strategy is
that if one fails, boot from the other to minimize down time of the
server)

Currently I boot from hard disk 0 on controller 0 (ad0). Then I
manually mount hard disk 1 (ad2). All of my real time data is mirrored
from ad0 to ad2 periodically by cron jobs.

Now I guess, I can edit /etc/fstab file located on hard disk 1 (ad2),
so that it mounts correctly as ad2 when booted from.

Then I plan to ask the hosting company to set hard disk 1 (ad2) as the
primary boot device in bios, and reboot.

-------------

One more thing:
I have all configs + apps setup on ad0, but none on ad2.

Can I just binary copy and overwrite the /etc, /usr of ad0 on ad2, to
save time of installing / configuring applications again on ad2 ?

Both ad0 and ad2 are physically and partitionally equal sized disks
with 5.3 on them (installed from the same source).


Thanks again.
Mike


pachl wrote:
> Matthew X. Economou
> > If I recall correctly, the only thing you need to change is the device
> > names in /etc/fstab. You will probably have to boot into single user
> > mode to do it, that is to say, after you have made the physical
> > hardware change:
> Matthew's suggestion snipped.
>
> siliconmike, if you can run in single user mode, I would try Matthew's
> suggestion. How will you be getting into single user mode remotely?
>
> Otherwise, here's what I would do remotely via ssh in multi-user mode:
>
> 1. # vi /etc/fstab (type the commands ``:%s/ad0/ad2/`` then ``:wq``)
> 2. # shutdown -h now
> 3. Call someone near the machine and tell them to turn off the machine,
> move the drive from the master position on the first controller to the
> master position on the second controller, and turn it back on.
> 4. As long as your BIOS loaded the boot loader on disk ad2, ultimately
> loading the kernel, the kernel will now use the new fstab and mount the
> partions normally. At this point you should be up and running.
>
> I'm assuming you don't have any kind of boot manager, the disk is
> dedicated to FreeBSD, and your BIOS will do what you want it to. I just
> tried this on an old Pentium 1 test machine with Award BIOS and a
> single system disk and it worked perfectly. You will have to figure out
> how you will handle your BIOS or if it will do this for you
> automatically.
>
> BTW, why are you moving your disk? What will be on the first
> controller?
>
> Good luck,
> Pachl
 >> Stay informed about: simple boot question 
Back to top
Login to vote
pachl

External


Since: Apr 30, 2005
Posts: 9



(Msg. 7) Posted: Thu Aug 18, 2005 12:15 am
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

siliconmike
> I have all configs + apps setup on ad0, but none on ad2.
>
> Can I just binary copy and overwrite the /etc, /usr of ad0 on ad2, to
> save time of installing / configuring applications again on ad2 ?
>
> Both ad0 and ad2 are physically and partitionally equal sized disks
> with 5.3 on them (installed from the same source).

Yes. To basically clone your ad0 disk, I would use dump/restore. I use
it all the time to do this. If you are just copying some configs and
userland, then I would probably use tar. Again, it's probably better to
do this task in single user mode, but I think you will not have
problems in multi-user mode. The fewer the files open the better for
tar; not such a big deal for dump since it takes snapshots (-L).

The FAQ will be a big help to you and gives examples of dump/restore.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#NEW-HUGE-DISK

If using tar, make sure you don't include the mount you are copying
into, eg. specifying /, which will recurse through /mnt and cause
problems. Also, be sure to use the -p switch after the pipe. For
instance, if you are copying /etc from ad0 to ad2, do:

# mount /dev/ad2a /mnt
# tar cf - /etc | tar pxf - -C /mnt

This should get you pointed in the right direction.

- pachl
 >> Stay informed about: simple boot question 
Back to top
Login to vote
Matthew X. Economou

External


Since: Feb 28, 2005
Posts: 32



(Msg. 8) Posted: Thu Aug 18, 2005 2:23 pm
Post subject: Re: simple boot question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>>>>> "siliconmike" == siliconmike writes:

siliconmike> Mathew and pachl, I cant thank you enough for the
siliconmike> advise. In fact I have 2 hard disks each with its own
siliconmike> FreeBSD. (The strategy is that if one fails, boot
siliconmike> from the other to minimize down time of the server)

If one disk fails, you won't be able to remotely log into the system
in order to re-configure the boot blocks. Instead, buy a RAID
controller supported by FreeBSD and mirror your disk. The 3ware SATA
RAID-0/1/5 controllers are reliable and inexpensive, and with proper
(and potentially automated) monitoring, single disk failures can be
detected and resolved long before they cause an outage.

Best wishes,
Matthew

--
jsoffron: I'm generally pretty high on national defense...
Mr. Bad Example: Careful...it's a gateway policy. Before you know it,
you'll be mainlining the hard stuff like trade agreements.
jsoffron: Too late...I've been freebasing Nafta all day... Sweet,
sweet NAFTA.
- As seen on Slashdot
 >> Stay informed about: simple boot question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
make depend error - simple option missing? - Hello! FreeBSD 4.9 i386 PIII 800 MHz PC: Dell Optiplex GX200 Following the FreeBSD Handbook Chapter 9 section on Building and Installing a Custom Kernel I edited the MYKERNEL file and proceeded to config MYKERNEL and to the ../../compile/MYKERNEL..

Help: Speeding up Boot Process - Sir, I've heard a lot of comments about the booting process of freebsd, that it is much faster than booting into Linux. I'm not experiencing quite as much as what their saying right now. Is there any link that you can give me so that I could learn ho...

Help: Speeding up Boot Process - Mark Jayson Alvarez writes: > I've already read the FreeBSD handbook's > essential parts for a typical users and I'm thinking > if I've missed something very important about speeding > up boot process. It would help if we could see the...

sound works with kldload, but not /boot/loader.conf? - Hi, I just tried playing a WAV file using xmms (this is the first time I've tried anything with sound on my installation). It issued a very generic error message, telling me things like "make sure your device is installed". I did some res...

New Question - The depth of my unix ignorance is showing... I kept getting a glitch, probably from my bad install attempt. I wiped my HD and re-installed FreeBSD with what I have learned. I have configured my xserver and it seems to be working ok. I read the the FreeBS...
   FreeBSD Hosting (Home) -> FreeBSD Handbook All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]