DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Installation and Upgrading

OpenBSD Installation and Upgrading Installing and upgrading OpenBSD.

Reply
 
Thread Tools Display Modes
Old 27th February 2019
acampbell acampbell is offline
Real Name: Anthony Campbell
Shell Scout
 
Join Date: Sep 2014
Location: London, UK
Posts: 138
Default

Quote:
Originally Posted by jggimi View Post
There are four things I can think of that would remove all files from a filesystem.
  1. Re-formatting with newfs(8).
  2. Removing them with an accidental rm(1) -r.
  3. An fsck(8) of a very damaged filesystem with either a "-y" option or answering "yes" to removing each and every file.
  4. Accidentally running the ramdisk's install script rather than the update script. This would cause #1 to occur.
Thanks iggimi. I think 4 may be the answer. I also thought you could simply enter the shell without running update but I presume that's wrong.
Reply With Quote
Old 27th February 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,020
Default

Yes you can enter the shell. When you boot the ramdisk kernel, you get the following prompt:
Code:
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
As you can see it is one of your four choices.
Reply With Quote
Old 2nd August 2024
Reeshar Reeshar is offline
Real Name: Richard L
Port Guard
 
Join Date: Feb 2022
Location: London, UK
Posts: 15
Default

Quote:
Originally Posted by jggimi View Post
To recover /home without loss during an install, you must be sure that:
  1. There is no /home partition defined during the install.
  2. That you capture the starting sector and size from the existing disklabel.
  3. That the install does NOT assign any sectors from the area currently containing /home to any partition.
  4. That after installation, you define the partition in the disklabel using the starting sector and length you recorded.
  5. That you add the partition to your fstab(5).
As a test to see if it worked, I followed this rather tedious process to maintain the existing partition structure but save the home directory across installs. I don't know what you think of it!

Assuming the /home directory is the k partition on disk sd0 and you're logged in as root:

1. Install new OS but when disklabel runs select existing OBSD partition, choose e(dit) and then:

> n k
mount point (/home) > none
> w
> x

2. With the new OS installed, assuming you've recreated the users as before:

# cd /home
# rm -r *
(to remove any created home directories but keep the /home mount point)

# disklabel -E -F /etc/fstab sd0
> m k
(keep size etc)
mount point > /home
> w
> x

3. (And I don't know whether this was necessary but the cpg value was wrong for the k partition so I updated it):

# disklabel -e sd0

(this invokes vi. Just change the cpg value to the same as the others - and the same as it was before - and save)

4. #disklabel sd0
....to check everything is fine and then...

5. Reboot!

I've written this up from memory so hopefully I've not made any mistakes. It's based on a total lack of knowledge of how disklabel and the install process work!
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
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


All times are GMT. The time now is 11:26 AM.


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