|
OpenBSD Installation and Upgrading Installing and upgrading OpenBSD. |
|
Thread Tools | Display Modes |
|
|||
Preserve /home during reinstall?
Something went bady wrong for unknown reasons after pkg_add and while trying to fix things I made them worse and ended with Err M on booting. The solution I used previously for this, thanks to iggimi, didn't work this time so I have to reinstall. But I'd like to preserve /home if at all possible. I think this can be done by putting "None" for mount in disklabel, but is that correct or is there a different way?
|
|
||||
Replying again for additional clarity and some step-by-step (from memory).
The ramdisk kernel can be booted, but it will need to be booted from install media, since the second stage of the on-disk bootloader is not available. Once booted, select the shell. You want to:
Code:
# mount /dev/sd0a /mnt # cat /mnt/etc/fstab Code:
# mount /dev/sd0p /mnt/usr # cd /mnt/usr/mdec # installboot -v -r /mnt sd0 biosboot boot Last edited by jggimi; 20th February 2019 at 04:54 PM. Reason: added wd0 comment |
|
|||
Thanks, iggimi, but I don't seem able to mount the root partition. Even if I could, and could solve the ERR issue, the system still wouldn't complete the boot - this was the original difficulty. Hence the decision to reinstall. A bit drastic, I know...
Can you kindly confirm that if I don't actually mount /home (i.e leave this at "none" in disklabel) it should not be overwritten? I think this is what the FAQ says but I'm not sure. |
|
||||
Quote:
Code:
# disklabel sd0 |
|
|||
Yes there us a valid disklabel when I run
# disklabel sd0 (from the install disk shell commant) |
|
||||
I recommend seeing if it is possible to mount any of the other partitions. If only the root partition has been damaged, you may be able to back up critical information in /home (and perhaps /var) that might otherwise be lost. The ramdisk kernel does not have dump(8), but I believe it has tar(1), which could be used to back up your critical information, if partitions are still mountable.
If /home is mountable, then -- yes -- it is possible to protect your current /home during a reinstall. I recommend backing up FIRST. The sectors currently used by the partition (as defined in the disklabel) must NOT be over written during install, so they must not be assigned to any partition during partition layout. After the installation has completed, the partition can be manually added to the disklabel(8) and to the fstab(5). |
|
||||
Additionally, to use the ramdisk kernel's shell for backup, please be aware that device nodes for disks other than sd0 and wd0 are not included in the ramdisk's filesystem, due to space limitations. To manage any additional drives, such as sd1, you must first create the nodes, with (for example):
Code:
# cd /dev # sh MAKEDEV sd1 |
|
|||
I can mount some of the partitions but /dev/sd0a appears to be empty. My /home is backed up nightly to tarsnap so I shall be able to recover stuff from there, although slowly.
I presume that while reinstalling the system I should delete the disklabel entry for /home to prevent its being overwritten? I'll try this tomorrow - brain too addled at the moment. |
|
||||
Having the tarsnap backup is terrific!
An upgrade rather than an install could be used to repopulate your root partition. But I think the effort would only be worth it if you also backed up /etc along with /home. To recover /home without loss during an install, you must be sure that:
|
|
|||
How about booting bsd.rd (or the same ISO used for installation) and then choose to upgrade?
Code:
Welcome to the OpenBSD/amd64 X.X installation program. (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? Last edited by albator; 20th February 2019 at 08:42 PM. Reason: Sorry jggimi, writing at the same time as you |
|
||||
Our posts may have overlapped, albator. An upgrade requires an existing /etc directory in a mountable root partition. In order to perform an upgrade, first acampbell would need to restore /etc. The upgrade script will not modify /etc, but it requires /etc/fstab and if the network is used it requires network configuration files such as /etc/hostname.* and /etc/resolv.conf.
|
|
||||
I'll also note that just because the root partition cannot be successfully mounted, it does not also mean that all data within is necessarily lost. It is possible that tools like fsdb(8) or sysutils/sleuthkit could be used as aids to recovery of existing data from the partition, if it still exists and has not been overlaid.
But that sort of forensic recovery requires a great deal of time and effort. And it also requires a separate, running OS with access to the damaged partition or a copy of the damaged partition. |
|
|||
Thanks again for help. I wasn't successful in preserving /home so I'm currently restoring from tarsnap (thanks, tarsnap).
Incidentally, I tried the bootstrap repair process on a spare old laptop; I couldn't make it work. There was no bjosboot in /usr/mdec, only mbr. Perhaps it needs the full cd64 iso? |
|
||||
Sorry you were unable to keep your existing /home from being overwritten on install.
Due to space limitations, the ramdisk kernel no longer comes with the bootloader files in the ramdisk's in-memory /usr/mdec. The files are included in the base fileset. The install and upgrade scripts run biosboot(8) using the just-installed or just-upgraded system's /usr/mdec/{biosboot,boot}. --- Edited to add: this is why the "reinstall boot blocks" how-to in post #3 included steps to mount the system's /usr partition as /mnt/usr and cd into /mnt/usr/mdec. Last edited by jggimi; 21st February 2019 at 05:43 PM. Reason: my how-to in this thread included using the on-disk bootloader files to install boot blocks |
|
|||
Yes I see. But when I mount /dev/wd0a (or any other partition) I always get an empty /mnt so I can't get any further.
Last edited by acampbell; 21st February 2019 at 08:59 PM. |
|
||||
Anthony, I can't look over your shoulder, so I can only go by what you've posted. And what you've posted is that you are able to mount a filesystem, but that the filesystem contains no files. That's possible, if you manually formatted these filesystems with newfs(8), they would mount cleanly and be empty of of any files.
It's also possible that you are not actually able to mount these filesystems, and are missing an error message. Is it possible that your mount commands are not completing successfully? The df(1) command will output a list of all mounted file systems, and how much storage is in free or allocated in each. |
|
|||
I haven't used newfs or anything similar. df shows that /dev/wd0a is mounted on /mnt but there are no files there. The same happens with other partitions, although some of them won't mount at all, saying "no such file".
Anyway, I think it's time to call it a day, at least for the moment and stop troubling you. Thank you for your patience. I must just remember never to interrupt an ungrade process to avoid getting into this situation. A year or two back I was able to complete this process without problems, so I don't know why it doesn't work for me now. |
|
|||
I've upgraded a few times, without problems, remembering to upgrade all packages too, & all my /home files remained untouched, so it does work normally.
__________________
Linux since 1999, & also a BSD user. |
|
||||
There are four things I can think of that would remove all files from a filesystem.
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reinstall while preserving /home | acampbell | OpenBSD Installation and Upgrading | 4 | 11th October 2015 04:40 PM |
How to reinstall the PBR? | acampbell | OpenBSD Installation and Upgrading | 1 | 30th July 2015 10:04 AM |
Reinstall OpenBSD 5.7 automatically (vps without KVM) | wesley | Guides | 0 | 1st June 2015 11:07 AM |
reinstall all packages installed by pkg_add | mfaridi | OpenBSD Packages and Ports | 4 | 5th March 2015 12:47 PM |
System messed up, should I just reinstall? | AncientDragonfly | FreeBSD Ports and Packages | 22 | 22nd April 2009 04:33 AM |