Slices don't show up in /dev

I've been running a FBSD FreeBSD 8 system for a while, and yesterday I tried upgrading it to 9, using freebsd-update. Well, something went wrong, and the system now refuses to boot. So I made a fresh 9 install on another drive, to troubleshoot or at least salvage my files, but the old drives slices don't show up in /dev. Here's the output of fdisk /dev/ada1:
Code:
******* Working on device /dev/ada1 *******
parameters extracted from in-core disklabel are:
cylinders=239340 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=239340 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 241248042 (117796 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
And here's disklabel /dev/ada1:
Code:
# /dev/ada1:
16 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  c:  241254720          0      swap                      # "raw" part, don't edit
disklabel: partition c is not marked as unused!
disklabel: An incorrect partition c may cause problems for standard system utilities
 
Well, the problem is that the slices don't show up at all.
Code:
disklabel /dev/ada1s1
disklabel: unable to get correct path for /dev/ada1s1: No such file or directory
 
Update: I tried adding
Code:
kern.geom.part.check_integrity="0"
to /boot/loader.conf to see if that did anything, no dice.
Output of gpart show for the drive in question:
Code:
=>        0  241254720  ada1  BSD  (115G)
          0  241254720        - free -  (115G)
 
I don't want to change the disk, I just want to mount the filesystems on it. The problem is that the system can't seem to find them. I can start to boot from it, but it either just restarts itself, or hangs on an error (can't find /boot/loader.4th)
 
The gpart output in #4 says it's a "dangerously dedicated" disk, meaning a bsdlabel with no MBR. If it were, there would be no slice entries in /dev, just ada1a, ada1b, and so on.

But the next line says there aren't any BSD partitions. freebsd-update(8) should not have touched partition information, but it's hard to say what happened. It's not a bad idea to print out the partition table and tape it to the side of the machine. Few people back up the partition table.

If the default partitions were used back when FreeBSD 8 was installed, it shouldn't be too hard to recreate the partition table. Depends on the version of FreeBSD 8, I think / got bigger in the later versions.
 
Code:
dd if=/dev/ada1 bs=512 count=1 | hd -v
1+0 records in
1+0 records out
512 bytes transferred in 0.010545 secs (48554 bytes/sec)
00000000  fc 31 c0 8e c0 8e d8 8e  d0 bc 00 7c 89 e6 bf 00  |.1.........|....|
00000010  06 b9 00 01 f3 a5 89 fd  b1 08 f3 ab fe 45 f2 e9  |.............E..|
00000020  00 8a f6 46 bb 20 75 08  84 d2 78 07 80 4e bb 40  |...F. u...x..N.@|
00000030  8a 56 ba 88 56 00 e8 fc  00 52 bb c2 07 31 d2 88  |.V..V....R...1..|
00000040  6f fc 0f a3 56 bb 73 19  8a 07 bf 87 07 b1 03 f2  |o...V.s.........|
00000050  ae 74 0e b1 0b f2 ae 83  c7 09 8a 0d 01 cf e8 c5  |.t..............|
00000060  00 42 80 c3 10 73 d8 58  2c 7f 3a 06 75 04 72 05  |.B...s.X,.:.u.r.|
00000070  48 74 0d 30 c0 04 b0 88  46 b8 bf b2 07 e8 a6 00  |Ht.0....F.......|
00000080  be 7b 07 e8 b2 00 8a 56  b9 4e e8 8e 00 eb 05 b0  |.{.....V.N......|
00000090  07 e8 b0 00 30 e4 cd 1a  89 d7 03 7e bc b4 01 cd  |....0......~....|
000000a0  16 75 0d 30 e4 cd 1a 39  fa 72 f2 8a 46 b9 eb 16  |.u.0...9.r..F...|
000000b0  30 e4 cd 16 88 e0 3c 1c  74 f1 2c 3b 3c 04 76 06  |0.....<.t.,;<.v.|
000000c0  2c c7 3c 04 77 c9 98 0f  a3 46 0c 73 c2 88 46 b9  |,.<.w....F.s..F.|
000000d0  be 00 08 8a 14 89 f3 3c  04 9c 74 0a c0 e0 04 05  |.......<..t.....|
000000e0  be 07 93 c6 07 80 53 f6  46 bb 40 75 08 bb 00 06  |......S.F.@u....|
000000f0  b4 03 e8 59 00 5e 9d 75  06 8a 56 b8 80 ea 30 bb  |...Y.^.u..V...0.|
00000100  00 7c b4 02 e8 47 00 72  86 81 bf fe 01 55 aa 0f  |.|...G.r.....U..|
00000110  85 7c ff be 85 07 e8 19  00 ff e3 b0 46 e8 24 00  |.|..........F.$.|
00000120  b0 31 00 d0 eb 17 0f ab  56 0c be 78 07 e8 eb ff  |.1......V..x....|
00000130  89 fe e8 03 00 be 85 07  ac a8 80 75 05 e8 04 00  |...........u....|
00000140  eb f6 24 7f 53 bb 07 00  b4 0e cd 10 5b c3 8a 74  |..$.S.......[..t|
00000150  01 8b 4c 02 b0 01 56 89  e7 f6 46 bb 80 74 13 66  |..L...V...F..t.f|
00000160  6a 00 66 ff 74 08 06 53  6a 01 6a 10 89 e6 48 80  |j.f.t..Sj.j...H.|
00000170  cc 40 cd 13 89 fc 5e c3  20 20 a0 0a 44 65 66 61  |.@....^.  ..Defa|
00000180  75 6c 74 3a a0 0d 8a 00  05 0f 01 06 07 0b 0c 0e  |ult:............|
00000190  83 a5 a6 a9 0d 0c 0b 0a  09 08 0a 0e 11 10 01 3f  |...............?|
000001a0  bf 44 4f d3 4c 69 6e 75  f8 46 72 65 65 42 53 c4  |.DO.Linu.FreeBS.|
000001b0  66 bb 44 72 69 76 65 20  b1 00 80 0f b6 00 80 01  |f.Drive ........|
000001c0  01 00 a5 fe ff ff 3f 00  00 00 2a 27 61 0e 00 00  |......?...*'a...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
 
Strange... MBR looks fine. Could you post the binary of your MBR please?

# dd if=/dev/ada0 bs=512 count=1 | gzip > /tmp/mbr.gz

And then post the resulting /tmp/mbr.gz...
 
Whoops, sorry, that was for ada0. This is for ada1.
 

Attachments

  • mbr1.gz
    499 bytes · Views: 325
Well, I took your mbr1 file and applied it to an MD-backed device here - works fine:

Code:
# dd if=/dev/null of=d1 oseek=200000 bs=1m count=1
0+0 records in
0+0 records out
0 bytes transferred in 0.000017 secs (0 bytes/sec)

# mdconfig -a -t vnode -f /data/tmp/d1
md0

# dd if=~aragon/Downloads/mbr1 of=/dev/md0 bs=512 count=1
1+0 records in
1+0 records out
512 bytes transferred in 0.027293 secs (18759 bytes/sec)

# ls -l /dev/md*
crw-rw----  1 root  vboxusers    0, 174 Feb  9 21:19 /dev/md0
crw-rw----  1 root  vboxusers    0, 175 Feb  9 21:19 /dev/md0s1
crw-rw----  1 root  vboxusers    0, 173 Feb  9 21:18 /dev/mdctl

# gpart show md0
=>       63  409599937  md0  MBR  (195G)
         63  241248042    1  freebsd  [active]  (115G)
  241248105  168351895       - free -  (80G)

(Running FreeBSD 9.0-RELEASE amd64)

Are you sure you're posting the same data?
 
Well, if you post more of your disk I'll test that here too. Say the first 512 KiB? That will expose a bit of your root file system data to me though.

Maybe something's blowing up after the MBR.
 
From my brief look at that dump, it looks like your disk was formatted as a dedicated BSD label before you installed FreeBSD 9.0. When you installed FreeBSD 9.0 it got overwritten with an MBR and a new BSD label 63 sectors offset into your old one.

Sooo, I'm not sure what's left of your data or if it can be recovered. Certainly parts of your old BSD label have been overwritten, and I'm not sure what else.

I don't suppose you remember or have a copy of your old BSD label structure? If I overwrite the new MBR with a BSD label that matches your old layout, your file system data might be good.
 
I think I found your old BSD label:

Code:
=>        0  409600000  md0  BSD  (195G)
          0    1048576    1  freebsd-ufs  (512M)
    1048576    4129504    2  freebsd-swap  (2G)
    5178080    4161536    4  freebsd-ufs  (2G)
    9339616    1048576    5  freebsd-ufs  (512M)
   10388192  230859850    6  freebsd-ufs  (110G)

Does that look like it?

Unexpectedly I found it where I thought the new BSD label had been written.

The other BSD label at the start of the disk is empty, but I figured it was an old label since it has legacy labely stuff in it, such as your disk's model number (IC35L120AVV207). Pretty sure only old versions of FreeBSD kept that in the BSD label.

More detailed history about your disk might be helpful. :)
 
I've used this same disk since, I don't know, FreeBSD 7.0 or something. I think I reformatted and partitioned it when upgrading to 8, but I'm not sure. That BSD label does look like it could be correct, I'm unfortunately not that experienced in this area so I haven't saved the layout anywhere nor am I completely sure when I reformatted last. But if that's the only label you can find, it probably is the correct one, right? So, how to rewrite it correctly to the disk? I guess I can dd the entire disk before trying anything, just to be sure I don't do anything irreversible.
 
Franky said:
I guess I can dd the entire disk before trying anything, just to be sure I don't do anything irreversible.
Absolutely yes, do that please.

I did some more poking around, and tested your 512k dump on a 7.1 box of mine. It had no problem seeing it as a disk with MBR and BSD label in the first slice, and the label partitions were identical to what I posted at [post=165962]#17[/post]. I guess this must be fall out with your old 7.x data lingering in the MBR<->Slice gap, and 8.x's drop of dedicated support.

Anyway, hopefully this should fix things:

# dd if=/dev/zero of=/dev/ada1 bs=512 oseek=1 count=62
 
It works! I can't thank you enough! I guess this teaches me not to blindly upgrade to each new release, at least not without doing a proper backup of the system drive first. Again, thanks a million!
 
Back
Top