OpenBSD-alternative Installation Method

Source: Internet
Author: User

Author: rainren from: http://bbs.chinaunix.net/

OpenBSD-alternative Installation Method

April January 3
In yesterday's documents, I still did not know about it in some places. I operated it again last night and got to know it again. in today's documents, we only need to back up the files in the system to clone a new system.

I have installed several openbsdks to set up LAN, so it is easy to operate.

Step 1: Remember the mount points on your hard disk. My partitions are as follows:
/Dev/wd0a/
/Dev/wd0b swap
/Dev/wd0d/var
/Dev/wd0e/tmp
/Dev/wd0f/usr
To clone a new system from a hard disk, the mount points must be the same, that is, the Mount numbers must be the same as those written on/etc/fstab.

Step 2: Back up the file:
The main backup files are/dev/wd0a,/dev/wd0d, And/dev/wd0f mount points. I saved the files of these three mount points as root. tgz, var. tgz, usr. tgz ., in the/usr/back/directory.

Step 3: mount the New Hard Disk wd1 and we will clone the system:
1. New Hard Disk Partition:
Fdisk-I wd1
Disklabel-E wd1
The Mount Points of disklabel are the same as those described in the first step. The size of each partition can be freely changed.
2. format the partitions.
Newfs/dev/wd1a
Newfs/dev/wd1d
Newfs/dev/wd1e
Newfs/dev/wd1f
3. Set mbr for the new hard drive wd1:
Fdisk-u-f/usr/mdec/mbr wd1
4. Remove the backed up system file to the corresponding wd1 partition:
Mount/dev/wd1a/mnt
Cd/mnt
Tar xvzfp/usr/back/root. tgz
Cd
Umount/mnt
Mount/dev/wd1d/mnt
Cd/mnt
Tar xzvfp/usr/back/var. tgz
Cd
Umount/mnt
Mount/dev/wd1f/mnt
Cd/mnt
Tar xvzfp/usr/back/usr. tgz
Cd
Umount/mnt
Here I would like to thank the three-wheeled staff for prompting them to add the p parameter during tar decompression so that the file does not change. In addition, it is best to fix and check the fsck when mounting each partition.
5. Set pbr:
Fsck/dev/wd1a
Mount/dev/wd1a
Cp/usr/mdec/boot/mnt/boot
/Usr/mdec/installboot-v/mnt/boot/usr/mdec/biosboot wd1
OK! Now the operation is complete. An openbsd system has been installed on the wd1 hard disk. Change the wd1 hard disk to the boot disk, and you will have a new system.

When backing up the files in each partition in step 2, you can think of the floppy disk system on cnfug. During the backup, you can delete some files that you do not think you do not need and reduce the number of files in the system, the cloned system is smaller!

In step 5, I have another idea about coexistence with multiple systems such as windows. I will try again later!

The openbsd startup tool is stored in the/usr/mdec/directory. For more information, see.

In the method I mentioned, you can back up a system multiple times, mainly for file backup in three zones. I have performed several backups, the first is the system that was initially installed, the second is the backup after the locale patch is installed, and now the software is installed to prepare the third backup. you can recover the system whenever you want!

Last night I only used half a minute to clone wd1 from a new system, so the operation was fast.

It mainly takes time to decompress the backup file.

 

First version in January 2
When I came back last night and watched the Backup Recovery mbr command, I suddenly thought that I could move the system to the new hard disk. When I thought about it, I started the operation. From the backup operation to the new hard disk, the system was successfully started, the entire process took less than two hours.

Required: An OpenBSD system that has been installed and configured, an empty hard disk that has not been installed.

I am operating under OpenBSD3.6. before the operation, I will briefly introduce the system startup process of OpenBSD.

On the i386 platform, OpenBSD is started in two steps. When the system starts up, MBR is started first, and PBR (partition boot record) is started again. mbr indicates where the system starts, pbr is the loading/boot startup system,
You can perform these two steps on your own. For details about How to install OpenBSD/i386 boot in OpenBSD FAQ 14, see How does OpenBSD/i386 boot? This section.

Next I will introduce how to move an installed and configured OpenBSD system to a new hard disk, and then we can use OpenBSD on the new hard disk.

1. Back up MBR. Of course, if you do not back up the mbr, you can also use/usr/mdec/MBR (I have not performed this operation yet, only when reading man pages, it is described above)
Dd if =/dev/wd0a of = boot. bin bs = 512 count = 1
This step always prompts that the hard disk is busy, so I mounted this hard disk to another system to back up the mbr:
Dd if =/dev/wd1a of = boot. bin bs = 512 count = 1

2. Back up system files. All files under the/tmp directory are backed up, except for files under the/tmp directory.
My system partitions are wd0a/, wd0b swap, wd0d/var, wd0e/tmp, wd0f/usr:
Like the backup mbr, I mounted the hard disk to another system:
Mount/dev/wd1a/mnt
Cd/mnt
Tar zcf ~ /Back/root.tar.gz.
Umount/mnt
Mount/dev/wd1d/mnt
Cd/mnt
Tar zcf ~ /Back/var.tar.gz.
Umount/mnt
Mount/dev/wd1f/mnt
Tar zcf ~ /Back/usr.tar.gz.

Cd ~ /Back/
Mv *. gz/mnt/
Cd
Mv boot. bin/mnt
Halt-p

3. Install the new hard disk.
1. Partition: fdisk-I wd1
2. disklabel-E wd1 (the mount point here should be the same as the mount point of/etc/fstab. In the past, the system divided several mount points, now this hard disk is divided into several mount points ).

4. Configure mbr for the new Hard Disk:
Dd if = boot. bin of = wd1
Here is the FAQ on how to restore the mbr operation. I have not tried it yet.
Fdisk-u-f/usr/mdec/mbr wd0 (wd0 is changed to wd1, now we set mbr for wd1)

5. Configure pbr for the new Hard Disk:
Operation steps: installboot (8 );
Fsck/dev/wd1a
Mount/dev/wd1a/mnt
Cp/usr/mdec/boot/mnt/boot
/Usr/mdec/installboot-v/mnt/boot/usr/mdec/biosboot wd1

6. Remove the System File backed up in step 2 to the new hard disk.
First, the root.tar.gz, var.tar.gz, and usr.tar.gz files are stored in the/usr directory,
Remove root.tar.gz to/dev/wd1a and var.tar.gz to/dev/wd1d and usr.tar.gz to/dev/wd1f.

Now, you can turn off the original system, remove the hard disk, change wd1 from the hard disk to wd0 from the primary hard disk, and start OpenBSD on the new hard disk! Basically, the OpenBSD System of the master hard disk is cloned to the slave hard disk. it is found that the error XKB is reported when gnome is started. Which of the following brokers can explain the information about XKB? Go back and check other changes tonight ~~!

The above operations have errors. Please point them out!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.