DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 16th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default Install OpenBSD in more than one disk partition?

OpenBSD is already installed in a disk partition.

I wish to install OpenBSD in another disk partition.

When I was trying to do that, a message popped up during fdisk partitioning:

Code:
fdisk: MBR contains more than one OpenBSD partition.
Write MBR anyway?
What shall I do?
Reply With Quote
  #2   (View Single Post)  
Old 16th July 2015
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,276
Default

Quote:
Originally Posted by betweendayandnight View Post
I wish to install OpenBSD in another disk partition.
Not on the same disk. If the BIOS on your motherboard can boot from an external device (as in a USB flash drive...), this will be the easiest vector to having multiple versions of OpenBSD installed on the same hardware.

How to install on an external device? Boot bsd.rd & specify the attached device as the root disk.

...& for bonus points, back up all important data before embarking on such a project.
Reply With Quote
  #3   (View Single Post)  
Old 17th July 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,944
Default

While it is possible to have multiple OpenBSD systems in separate MBR partitions, it requires third party boot managers and there are configuration limitations. I've done it, but there are easier ways to manage multiple OpenBSD systems on a single computer. The easiest method is to use multiple drives, as ocicat recommends.

The second easiest method is to install a second OpenBSD sysem into the same MBR partition, just into a new disklabel partition created from unallocated storage You can select the kernel and root partition at boot time. And the easiest way to install a second system onto the same drive is to install first onto a second drive, such as a handy USB stick, then replicate its contents into the new disklabel partition back on the first drive.

Yes, it is possible for someone to do install a second copy of OpenBSD without a second drive, but it is far more difficult. And error prone. There are two methods: manually unpacking the filesets and deploying /etc infrastructure manually, or the far more risky path of manipulating disklabels and DUIDs from the RAMDISK kernel in order to use the install script with the new partition temporarily defined as "a" partition during install and without overlaying your existing system, then manipulating disklabels and DUIDs again once the installation is complete, and then finally editing the new fstab(5) to permit addressing for the restored DUID.
If the above paragraph seems ridiculously complex, risky, tedious, and prone to failure, then ask someone who's done it multiple times. Me. It is even more complex, risky, and tedious than described. Doable? Yes. Did I backup first? Every time. Did I ever need to restore? ... ... Yes. Once I had to restore /etc files that I fumbled into destruction. I've also had to reinstall boot blocks from installation media. More than once. More than twice.
Now, if you really want to have OpenBSD systems in separate MBR partitions, then....
...Let us suppose for the sake of argument: the world is flat, and you wished to sail off of its edge. If so, the map that you can follow to the edge of the world and beyond can be obtained from the sysutils/grub port. It is not a detailed map. Nor does it say, "There Be Dragons."
The contents of the OpenBSD specific README for that port will be installed into /usr/local/share/doc/pkg-readmes if you install the grub package from your nearest mirror. But you can also read it online, without installation, directly from the web portal to the OpenBSD CVS repository here. The instructions are not a step-by-step how-to, they are general guidance for the provisioning limitations of multibooting a configuration that has already been configured with multiple OpenBSD systems in separate MBR partitions.

Alternatively if you have modern hardware, it may be capable of running a hipervisor that can host OpenBSD as a guest virtual machine. But that's out of scope for this discussion thread.

--

Here's the TL;DR - If you want to have multiple OpenBSD systems on a single computer, both ocicat and I recommend you use multiple drives.

Last edited by jggimi; 17th July 2015 at 12:52 AM. Reason: clarity, grammar, typos, and etc.
Reply With Quote
  #4   (View Single Post)  
Old 17th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default

Quote:
Originally Posted by jggimi View Post
The easiest method is to use multiple drives, as ocicat recommends.
I'd love to. Alas, OpenBSD's native USB 3.0 support is still in development.

Quote:
Originally Posted by jggimi View Post
The second easiest method is to install a second OpenBSD sysem into the same MBR partition, just into a new disklabel partition created from unallocated storage
That was what I did and there was a warning message from fdisk. (see my original post for the message.)

Quote:
Originally Posted by jggimi View Post
You can select the kernel and root partition at boot time.
What are the commands please? I only know about

boot -s

Quote:
Originally Posted by jggimi View Post
And the easiest way to install a second system onto the same drive is to install first onto a second drive, such as a handy USB stick, then replicate its contents into the new disklabel partition back on the first drive.
I'd appreciate more details on how to replicate the installed contents on the USB stick to the new disklabel partition on the first drive. Thanks in advance.

Quote:
Originally Posted by jggimi View Post
Yes, it is possible for someone to do install a second copy of OpenBSD without a second drive, but it is far more difficult. And error prone.
No thanks; I'm not going down that route.
Reply With Quote
  #5   (View Single Post)  
Old 17th July 2015
ibara's Avatar
ibara ibara is offline
WR Slowest SNOBOL4 laptop
 
Join Date: Jan 2014
Posts: 515
Default

Quote:
Originally Posted by betweendayandnight View Post
What are the commands please? I only know about

boot -s
boot(8)
http://www.openbsd.org/cgi-bin/man.c...th=OpenBSD-5.7
Reply With Quote
  #6   (View Single Post)  
Old 17th July 2015
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,944
Default

Quote:
Originally Posted by betweendayandnight View Post
I'd love to. Alas, OpenBSD's native USB 3.0 support is still in development.
While it may not be as fast, and you may not currently be able to exploit it, USB 2.0 devices work fine. eSATA is yet another option, should you have the equipment.
Quote:
That was what I did and there was a warning message from fdisk.
No, this warning comes when you attempt to provision multiple MBR partitions for OpenBSD. Adding a disklabel partition to an existing system uses disklabel(8), not fdisk(8).

For clarity, there were three options I discussed above: a) 2nd drive, b) adiditonal disklabel partitions, and c) additional MBR partitions. Option b) does not touch MBR partitioning.
Quote:
I'd appreciate more details on how to replicate the installed contents on the USB stick to the new disklabel partition on the first drive. Thanks in advance.
You can use dump(8) and restore(8). Here's a very brief "how-to", written from memory, and therefore, what I provide here may be in error. Please don't blindly copy/paste anything, but review the applicable man pages. Assumptions for the how-to follow. Change device numbers or partition letters as needed.
  • You plan on having a test OpenBSD system available for boot within a separate disklabel partition. As it is a test system, it will reside on a single partition on your production drive.
  • sd0 is your production drive. It has unallocated space within the pre-existing OpenBSD MBR partition. Partitions "a" through "j" are already defined, the next free partition letter is "k".
  • sd1 is your device you just installed a fresh OpenBSD system on. It was a 4GB USB stick you happened to have.
  • When you installed on the USB stick, you used a custom partitioning scheme and defined a single partition, "a", for everything. You made it 1GB in size, more than sufficient to install all filesets and kernels.
Steps:
  1. Boot your production system.
  2. Using disklabel(8), define the new "k" partition to house your test OpenBSD system. The disklabel program has an interactive label editor.

    # disklabel -E sd0

    Follow the man page and use the the interactive editor to add the new partition.

    > a k

    Prompts appear, asking for offset -- the default is the first unallocated sector, which you may use, then the next prompt is for size -- where you would add the size of your system. The default response (number of free sectors currently available) and any typed response is assumed to be sectors, so use a number followed by the letter "g" for "gigabytes." For example, to create a 5GB partition, use "5g". The next prompt is for filesystem type -- take the default, which is used for OpenBSD FFS filesystems. Then, you may use the "w" and "q" commands to write the revised disklabel and quit.
  3. Format the new partition, with newfs(8).

    # newfs sd0k
  4. Insert the USB stick, if it isn't already connected.
  5. Mount the new filesystem. It can be mounted async for write performance during the data transfer.

    # mount -o async /dev/sd0k /mnt
  6. Copy the contents from the USB stick to the hard drive. It need not be mounted; the dump(8) program needs only the device and partition.

    # cd /mnt; dump -0af - /dev/sd1a | restore -rf -
  7. The -r option of the restore program will create a symbol table file restoresymtable in the base directory, which may be deleted after the restore completes, as it is only used when you have multiple restore operations to conduct.
  8. Edit the fstab(5) in the test system. It will need to use the production disk's DUID and partition letter "k" rather than the DUID or device number and "a", used during installation.

    # $EDITOR /mnt/etc/fstab
  9. Remove the USB stick, and boot the "bsd" kernel from sd0k. You must use the -a option at the boot> prompt, because the "k" partition will be the root directory.

    # reboot
    boot> hd0k:/bsd -a

    You will be prompted for root directory, respond with sd0k. You will be prompted for the swap partition, and you should take the default, sd0b.
WARNING WARNING WARNING. BACK UP YOUR DATA BEFORE ATTEMPTING THIS. I may have made an error in my how-to, as it is just typed up from memory. And you may make a typo or other error, inadvertently destroying data you want to retain.

Last edited by jggimi; 17th July 2015 at 04:02 PM. Reason: typos. lots of typos.
Reply With Quote
  #7   (View Single Post)  
Old 17th July 2015
betweendayandnight betweendayandnight is offline
friendly
 
Join Date: Jul 2015
Posts: 67
Default

Thanks jggimi for taking the time and putting in the effort to come up with a comprehensive guide.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clean install of OpenBSD but keeping existing partition table daemonbak OpenBSD Installation and Upgrading 8 27th May 2015 10:39 PM
openbsd 5.6 install can not detect my western digital USB disk mfaridi OpenBSD Installation and Upgrading 28 14th February 2015 03:26 AM
OpenBSD -current install mising half size of a 1 tb disk daemonfowl OpenBSD Installation and Upgrading 10 7th June 2013 07:28 PM
disk partition layout advise Fred974 FreeBSD Installation and Upgrading 14 8th November 2011 12:10 PM
Preserving existing OpenBSD partition layout during a re-install J65nko Guides 3 17th February 2010 03:55 AM


All times are GMT. The time now is 04:00 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick