Quoting Otto Moerbeek <[email protected]>:

On Fri, Jul 10, 2015 at 04:04:04PM +0000, Vijay Sankar wrote:

My objective for this weekend was to follow the new dpb and build ports
without using sudo. So I was hoping to upgrade to the latest snapshot on a
system that I use for tests.

The test system has a 2TB drive and it had two 300GB partitions in it for
ports and vm; and a 120GB SSD for the OS and used to look as follows:

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd1a     1005M   55.0M    900M     6%    /
/dev/sd1k     64.5G   20.9G   40.3G    34%    /home
/dev/sd1d      3.9G   10.0K    3.7G     0%    /tmp
/dev/sd1f      2.0G    966M    946M    51%    /usr
/dev/sd1g     1005M    191M    764M    20%    /usr/X11R6
/dev/sd1h      9.8G    2.9G    6.5G    31%    /usr/local
/dev/sd1j      2.0G    2.0K    1.9G     0%    /usr/obj
/dev/sd1i      2.0G    827M    1.1G    43%    /usr/src
/dev/sd1e     13.5G   26.5M   12.8G     0%    /var
/dev/sd0h      298G    176G    107G    62%    /ports
/dev/sd0f      298G   19.6G    263G     7%    /vm

My /etc/fstab was

4f0cd8b5e7fd8f6a.b none swap sw
4f0cd8b5e7fd8f6a.a / ffs rw 1 1
4f0cd8b5e7fd8f6a.k /home ffs rw,nodev,nosuid 1 2
4f0cd8b5e7fd8f6a.d /tmp ffs rw,nodev,nosuid 1 2
4f0cd8b5e7fd8f6a.f /usr ffs rw,nodev 1 2
4f0cd8b5e7fd8f6a.g /usr/X11R6 ffs rw,nodev 1 2
4f0cd8b5e7fd8f6a.h /usr/local ffs rw,nodev 1 2
4f0cd8b5e7fd8f6a.j /usr/obj ffs rw,nodev,nosuid 1 2
4f0cd8b5e7fd8f6a.i /usr/src ffs rw,nodev,nosuid 1 2
4f0cd8b5e7fd8f6a.e /var ffs rw,nodev,nosuid 1 2
4d43e3389228e319.h /ports ffs rw,nodev,nosuid 1 2
4d43e3389228e319.f /vm ffs rw,nodev,nosuid 1 2

I am not sure what happened -- but when I rebooted the system this morning
/ports and /vm would not mount; so I commented out the last two lines in
/etc/fstab and rebooted. After reboot disklabel seems to have changed
completely and it currently looks like this:

# disklabel sd0
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: ST2000DM001-1CH1
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 503
total sectors: 8089950
boundstart: 0
boundend: 8089950
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  c:          8089950                0  unused


Is there any way fix the disklabel or is this an error that is impossible to
recover from? duid used to show up as 4d43e3389228e319 and not
0000000000000000.

Please let me know if you have any suggestions.

Get your old label from /var/backups and try to restore it with
disklabel -R.  You don't tell what your platform is, it might be that
you also need to do fdisk work first to restore the mbr partition
table.

But of course, it is also interesting to know what happened to you
disk. But since you do not tell us what you did you are on your own
here.

        -Otto

Thank you very much. I am running an older snapshot OpenBSD 5.7 -current as of Mar 19, 2015. I thought of -R with disklabel but since the drive seems to show itself as a 3950MB drive instead of a 2TB drive, I was not sure how to do this.

The problem truly is I am not sure what I did to cause all this problem!!! The sequence of actions were as follows. Since I had not looked at this box for a while I was just logging in to look at where I had kept everything. I did a cd /ports/packages/amd64/all and got an input error when I tried to edit a file. So I did a shutdown -h now; opened the 3.5" and 2.5" hotswap drive bays and pulled both drives out and pushed them back in. Powered the system on at which point I was dropped into the shell because /vm and /ports had errors. So I tried to do a fsck_ffs and that failed. At that point I looked at disklabel and noticed that the duid was gone. fdisk sd0 does not show anything other than:

# fdisk sd0
Disk: sd0       geometry: 503/255/63 [8089950 Sectors]

I tried the disklabel -R as you suggested;

# disklabel -R sd0 disklabel.sd0.current
disklabel: partition a: partition extends past end of unit
disklabel: partition c: partition extends past end of unit
disklabel: partition d: offset past end of unit
disklabel: partition d: partition extends past end of unit
disklabel: partition e: offset past end of unit
disklabel: partition e: partition extends past end of unit
disklabel: partition f: offset past end of unit
disklabel: partition f: partition extends past end of unit
disklabel: partition g: offset past end of unit
disklabel: partition g: partition extends past end of unit
disklabel: partition h: offset past end of unit
disklabel: partition h: partition extends past end of unit
disklabel: partition i: offset past end of unit
disklabel: partition i: partition extends past end of unit

Also tried
# fdisk -i sd0
Do you wish to write new MBR and partition table? [n] y
Writing MBR at offset 0.
fdisk: error writing MBR: Input/output error

Not sure whether there is any other option but Thanks very much for the help and advice.

Vijay
--
Vijay Sankar, M.Eng., P.Eng.
ForeTell Technologies Limited
[email protected]

Reply via email to