How to install bootmanager on backup disk? - BSD

This is a discussion on How to install bootmanager on backup disk? - BSD ; Hello freebsd gurus ... I have what I think is probably an easy question for you: how can I make a backup disk that has /, /usr, / tmp, /var etc. partitions so that it is bootable? Here's the situation: ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: How to install bootmanager on backup disk?

  1. How to install bootmanager on backup disk?

    Hello freebsd gurus ... I have what I think is probably an easy
    question for you: how can I make a backup disk that has /, /usr, /
    tmp, /var etc. partitions so that it is bootable?

    Here's the situation: I come for a Linux background but inherited
    admin of a FreeBSD system (still 6.1). This system has /, /tmp, /var
    on one disk, and /usr on another disk. There was no backup system.

    My first move was to institute some sort of backup, and I chose to use
    one that I find convenient on Linux: have a backup disk that is
    rsync'd periodically with the main disks, and make it bootable so that
    if anything happens to the main disks, I can just swap cables and boot
    off the backup. IOW, I would reconnect the backup disk as the primary
    master and boot from it, using it as the main disk at least
    temporarily.

    The first part is done: I installed one disk big enough for all the
    partitions, created one slice and four partitions, and rsync'd it. But
    how do I make it bootable, ie how do I install a bootmanager on it?
    On Linux, I can boot off either a floppy (remember those?) or a live
    CD and install lilo or grub.

    Since I'm new to FreeBSD, it is with trepidation that I use fdisk,
    boot0cfg, disklabel, etc. - I definitely don't want to endanger the
    bootability of the main system.

    Once I have some sort of backup, I want to take the next step: use a
    USB backup disk so that it can be physically removed. That's what I
    do on Linux: I use automount to sense the backup drive, the rsync to
    it. I know FreeBSD has atd and so it has some similar capability,
    right? But first I want to be able to boot off my PATA backup drive.

    Thanks for any hints or advice!

    Jim

  2. Re: How to install bootmanager on backup disk?

    n33ed wrote:

    > Here's the situation: I come for a Linux background but inherited
    > admin of a FreeBSD system (still 6.1). This system has /, /tmp, /var
    > on one disk, and /usr on another disk. There was no backup system.
    >
    > My first move was to institute some sort of backup, and I chose to use
    > one that I find convenient on Linux: have a backup disk that is
    > rsync'd periodically with the main disks, and make it bootable so that
    > if anything happens to the main disks, I can just swap cables and boot
    > off the backup. IOW, I would reconnect the backup disk as the primary
    > master and boot from it, using it as the main disk at least
    > temporarily.
    >
    > The first part is done: I installed one disk big enough for all the
    > partitions, created one slice and four partitions, and rsync'd it. But
    > how do I make it bootable, ie how do I install a bootmanager on it?
    > On Linux, I can boot off either a floppy (remember those?) or a live
    > CD and install lilo or grub.


    FreeBSD can also use those methods. (It's been a long time since I've
    used anything other than boot0cfg or a plain MBR, though.)

    > Since I'm new to FreeBSD, it is with trepidation that I use fdisk,
    > boot0cfg, disklabel, etc. - I definitely don't want to endanger the
    > bootability of the main system.


    The man page examples for boot0cfg shows how to install it and also how
    to use fdisk to install the default non-interactive MBR. Use df to see
    which device is which; probably ad0 for your PATA boot drive, varies for
    the second depending on where it's attached.

    > Once I have some sort of backup, I want to take the next step: use a
    > USB backup disk so that it can be physically removed. That's what I
    > do on Linux: I use automount to sense the backup drive, the rsync to
    > it. I know FreeBSD has atd and so it has some similar capability,
    > right?


    amd(8)? But you can also use glabel(8) to label a device uniquely, and
    then that will show up in /dev when that device is attached. Combine
    that with cron and a script and it may be more appropriate for backup.

    --
    Warren Block * Rapid City, South Dakota * USA

  3. Re: How to install bootmanager on backup disk?

    On Tue, 15 Jul 2008 09:24:17 -0700, n33ed wrote:

    > Hello freebsd gurus ... I have what I think is probably an easy question
    > for you: how can I make a backup disk that has /, /usr, / tmp, /var etc.
    > partitions so that it is bootable?
    >
    > Here's the situation: I come for a Linux background but inherited admin
    > of a FreeBSD system (still 6.1). This system has /, /tmp, /var on one
    > disk, and /usr on another disk. There was no backup system.


    You mean you don't have it running Linux yet?

    >
    > My first move was to institute some sort of backup, and I chose to use
    > one that I find convenient on Linux: have a backup disk that is rsync'd
    > periodically with the main disks, and make it bootable so that if
    > anything happens to the main disks, I can just swap cables and boot off
    > the backup. IOW, I would reconnect the backup disk as the primary master
    > and boot from it, using it as the main disk at least temporarily.
    >
    > The first part is done: I installed one disk big enough for all the
    > partitions, created one slice and four partitions,


    I use hot swap removable drives for backup, so after slicing and
    partitioning the drive like you've done above, I run a fairly elaborate
    interactive shell script to ensure that I don't screw up.

    Since its easier for me to show an example than try to explain it,
    I've extracted only the essential commands from a script having many lines
    of code to parse, validate, and eliminate human input error into a script
    presented below. Use at your own risk:

    #!/bin/sh
    # Target drive must be sliced and partitioned before running this script
    MOUNT_POINT="/mnt"
    EDITOR="vi"

    # Destination must include a fully qualified device name
    DEST="" # Example: /dev/ad6s1f

    # File system to back up
    SOURCE="" # Example: /usr

    newfs $DEST
    mount $DEST $MOUNT_POINT
    cd $MOUNT_POINT

    # Clean out old contents, if any
    chflags -R noschg *
    rm -rf *

    # Dump in new contents
    dump 0afL - $SOURCE | restore xf -

    cd /
    if [ "$SOURCE" = "/" ]
    then
    # /etc/fstab must be edited to make drive bootable
    $EDITOR $MOUNT_POINT/etc/fstab
    fi

    cd /
    umount $MOUNT_POINT
    # End of Script

    Note 1: For a complete backup, you have to edit the DEST and SOURCE lines
    and run the script for each File System you have: /, /tmp, /var, /usr, etc.

    Caution: If you make a typo error when editing the DEST and SOURCE lines
    in the above script, you have the potential of wiping out your entire
    system. The onus is on you to add whatever other commands you feel
    necessary that will parse and validate your settings for DEST and SOURCE
    and prevent the script from running if the values are incorrect. How you
    go about it is for you to figure out.

    Note 2: I run a system with all drives bootable and use the system BIOS to
    select which drive gets booted from. As a consequence, when I do a backup
    of a root partition, I need to edit /etc/fstab so that the entries therein
    point to the drive containing the backup rather than to the source drive
    that was backed up. The script ensures that I don't forget to do so by
    calling up the editor with /etc/fstab loaded for editing, when I backup
    the root partition. You may want to comment out or remove the code for
    this if it is not applicable to your situation.

    Note 3: After slicing/partitioning the drive and doing a complete backup,
    to keep the backup data refreshed, you have the option of either
    re-running the above script periodically, or running some other script
    that updates only selected files using some other method.

    Personally, I've found dump/restore to be the most reliable for doing
    backups and tend to favor it over other methods. Other backup methods,
    depending on which one is used, either ignore or do not always properly
    restore file links, file ownerships, file permissions, etc., which results
    in a lot of pain, should you actually have to use what you backed up.


    > and rsync'd it. But
    > how do I make it bootable, ie how do I install a bootmanager on it? On
    > Linux, I can boot off either a floppy (remember those?) or a live CD and
    > install lilo or grub.
    >
    > Since I'm new to FreeBSD, it is with trepidation that I use fdisk,
    > boot0cfg, disklabel, etc. - I definitely don't want to endanger the
    > bootability of the main system.


    Use -

    Command: sysinstall
    Option: Custom installation

    to slice and partition your backup drive, then run script presented above.

    >
    > Once I have some sort of backup, I want to take the next step: use a USB
    > backup disk so that it can be physically removed. That's what I do on
    > Linux: I use automount to sense the backup drive, the rsync to it. I
    > know FreeBSD has atd and so it has some similar capability, right? But
    > first I want to be able to boot off my PATA backup drive.
    >
    > Thanks for any hints or advice!
    >
    > Jim



  4. Re: How to install bootmanager on backup disk?

    Hi

    On 2008-07-16 02:24:17 +1000, n33ed said:

    > HeOnce I have some sort of backup, I want to take the next step: use a
    > USB backup disk so that it can be physically removed. That's what I
    > do on Linux: I use automount to sense the backup drive, the rsync to
    > it. I know FreeBSD has atd and so it has some similar capability,
    > right? But first I want to be able to boot off my PATA backup drive.


    I use sysinstall for this.
    Much easier.
    Create your partition as you want. Press W to make the changes. When
    you quit it will ask you what bootmanager you want to install. Select
    FreeBSD.
    That's it

    Then go into the label editor , create your volumes ...
    sysinstall will try to mount those, so you have to assign some dummy
    mount points

    Jean-Yves

    --
    They who would give up an essential liberty for temporary security,
    deserve neither liberty or security (Benjamin Franklin)


+ Reply to Thread