UFS Disk repair after mounting FreeBSD system within OpenBSD

funk47

New Member


Messages: 1

I was trying to dual boot both FreeBSD 10.3 and OpenBSD 6.0 on my machine by installing the two OS's to different disks and selecting the disk I wanted in the bios. This was successful until I mounted the FreeBSD disk within OpenBSD (and neglected to add a readonly option). The FreeBSD system no longer boots. I ran disklabel()
Code:
disklabel: /dev/ada1: no valid label found
I then tried scan_ffs(). The FreeBSD disk had three partitions and I ran scan_ffs() on all three:
Code:
# scan_ffs -l ada1p1
X: 2097152 24 4.2BSD 2048 16384 1 # /
scan_ffs: read: Input/output error

#  scan_ffs -l ada1p2
X: 8388576 17152120 4.2BSD 2048 16384 1 # /tmp
X: 37451936 25540696 4.2BSD 2048 16384 1 # /var
X: 4194304 62992632 4.2BSD 2048 16384 1 # /usr
X: 2097152 67186936 4.2BSD 2048 16384 1 # /usr/X11R6
X: 20971520 69284088 4.2BSD 2048 16384 1 # /usr/local
X: 4194304 90255608 4.2BSD 2048 16384 1 # /usr/src
X: 4194304 94449912 4.2BSD 2048 16384 1 # /usr/obj

# scan_ffs -l ada1p3
scan_ffs: read: Input/output error
It looks like the second partition has the default partitioning scheme as OpenBSD. I did not try to install OpenBSD on the FreeBSD disk, and I didn't do much beyond copy a file from the FreeBSD disk to the OpenBSD disk. I would like to restore the FreeBSD disk to be bootable since it is still readable by OpenBSD and presumably still has all of the data and files intact. What could have caused the FreeBSD disk to no longer boot? How should I go about trying to restore the FreeBSD disk?
 

Oko

Daemon

Reaction score: 770
Messages: 1,620

I am surprised to hear that you were able to mount FreeBSD ufs on OpenBSD. I have never heard that before. FreeBSD and OpenBSD UFS implementations are different and OpenBSD has no driver to my knowledge to read FreeBSD ufs file system. Maybe you can try to fsck FreeBSD partition which is messed up and see if you can repair it but I doubted.
 

Maxnix

Well-Known Member

Reaction score: 194
Messages: 315

I was trying to dual boot both FreeBSD 10.3 and OpenBSD 6.0 on my machine by installing the two OS's to different disks and selecting the disk I wanted in the bios. This was successful until I mounted the FreeBSD disk within OpenBSD (and neglected to add a readonly option). The FreeBSD system no longer boots. I ran disklabel()
Code:
disklabel: /dev/ada1: no valid label found
I then tried scan_ffs(). The FreeBSD disk had three partitions and I ran scan_ffs() on all three:
Code:
# scan_ffs -l ada1p1
X: 2097152 24 4.2BSD 2048 16384 1 # /
scan_ffs: read: Input/output error

#  scan_ffs -l ada1p2
X: 8388576 17152120 4.2BSD 2048 16384 1 # /tmp
X: 37451936 25540696 4.2BSD 2048 16384 1 # /var
X: 4194304 62992632 4.2BSD 2048 16384 1 # /usr
X: 2097152 67186936 4.2BSD 2048 16384 1 # /usr/X11R6
X: 20971520 69284088 4.2BSD 2048 16384 1 # /usr/local
X: 4194304 90255608 4.2BSD 2048 16384 1 # /usr/src
X: 4194304 94449912 4.2BSD 2048 16384 1 # /usr/obj

# scan_ffs -l ada1p3
scan_ffs: read: Input/output error
It looks like the second partition has the default partitioning scheme as OpenBSD. I did not try to install OpenBSD on the FreeBSD disk, and I didn't do much beyond copy a file from the FreeBSD disk to the OpenBSD disk. I would like to restore the FreeBSD disk to be bootable since it is still readable by OpenBSD and presumably still has all of the data and files intact. What could have caused the FreeBSD disk to no longer boot? How should I go about trying to restore the FreeBSD disk?
I had this problem myself, and that time I just backed up all my files and recreated slices and partitions. However, give a look at this discussion on DaemonForums: http://daemonforums.org/showthread.php?p=50146.
I am surprised to hear that you were able to mount FreeBSD ufs on OpenBSD. I have never heard that before. FreeBSD and OpenBSD UFS implementations are different and OpenBSD has no driver to my knowledge to read FreeBSD ufs file system. Maybe you can try to fsck FreeBSD partition which is messed up and see if you can repair it but I doubted.
I can't tell for previous versions, but since 5.6 I mounted in both ro and rw mode (and also wrote data to) FreeBSD partitions from OpenBSD without problems (with the exception that a rw mount, even without writing any data, makes the system unbootable). However, AFAIK OpenBSD can only read the first partition of a FreeBSD slice, but not others.
 
Top