View Single Post
  #6   (View Single Post)  
Old 17th July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
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