NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

restore super block? recover missing data?



On NetBSD 8.x I had a disk failing. I didn't write down complete kernel 
messages but like:

ahcisata0 clearing WDCTL_RST failed for drive 0
wd0
writing fsbn 288240960 ... bn 288243008
writing fsbn 544623424 ... bn 544625472

My system basically hung when I accessed some files. I had to power off 
a few times after I gave up waiting. I could use my shell but couldn't 
run any commands from file system. On next boot I could use system 
again. The problem seemed to happen when I looked a specific file or 
directory.  fsck showed me same file.

Single filesystem. I enabled wapbl so I could reboot faster.
mount -o log /dev/wd0a

I tried reading and writing to it with dd
dd if=/dev/rwd0d skip=288243008 out=/dev/null count=1
I should have saved to a file!
dd if=/dev/zero skip=288243008 out=/dev/rwd0d count=1
then read again

I didn't see any kernel messages at that time.

I also tried using badsect with same number. The manual says "sector" 
and the command-line usage says "blkno". It resulted in something like

   block ... in superblock area: cannot attach

When I tried to reboot my Dell said "Operation System Not Found" (that 
spelling). I couldn't boot from multiple USB flash disks either so 
unsure if other problems.

I removed the SATA 2.5 inch disk. There was an extra screw loose in 
around there. Don't know where it came from.

I put it into a USB adapter caddy and booted on a different NetBSD 9.2 
system:

Mar 19 18:44:29 localhost /netbsd: [ 3378.8978590] umass1 at uhub3 port 
1 configuration 1 interface 0
Mar 19 18:44:29 localhost /netbsd: [ 3378.8978590] umass1: JMicron 
(0x152d) USB to ATA/ATAPI bridge (0x2329), rev 2.00/1.00, addr 3
Mar 19 18:44:29 localhost /netbsd: [ 3378.8978590] umass1: using SCSI 
over Bulk-Only
Mar 19 18:44:29 localhost /netbsd: [ 3378.8978590] scsibus1 at umass1: 2 
targets, 1 lun per target
Mar 19 18:44:29 localhost /netbsd: [ 3378.8978590] sd4 at scsibus1 
target 0 lun 0: <ST964042, 3AS, 0001> disk fixed
Mar 19 18:44:29 localhost /netbsd: [ 3378.9077701] sd4: 596 GB, 16383 
cyl, 16 head, 63 sec, 512 bytes/sect x 1250263728 sectors

I have read over the entire rsd4d without any kernel messages (grepping 
for data which took     11290.89 real       156.49 user       152.81 
sys).

localhost# /sbin/disklabel  sd4
# /dev/rsd4:
type: SCSI
disk: 3AS             
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 1250263728
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a: 1250263728         0     4.2BSD      0     0     0  # (Cyl.      0 - 
1240340)
 d: 1250263728         0     unused      0     0        # (Cyl.      0 - 
1240340)
disklabel: boot block size 0
disklabel: super block size 0

-------------------------------

localhost# fsck /dev/sd4a
** /dev/rsd4a
BAD SUPER BLOCK: CAN'T FIND SUPERBLOCK
/dev/rsd4a: CANNOT FIGURE OUT SECTORS PER CYLINDER

-------------------------------

localhost# fsck_ffs -b 32 /dev/sd4a
Alternate super block location: 32
** /dev/rsd4a
BAD SUPER BLOCK: MAGIC NUMBER WRONG

-----------------------------------

Running for hours:

localhost# scan_ffs -b /dev/sd4a
Disk: 3AS             fictitious
Total sectors on disk: 1250263728

FFSv2 sb at 191 size 1237910688, last mounted on 
FFSv2 sb at 223 size 1237910688, last mounted on /
FFSv2 sb at 254 size 203423744, last mounted on 
FFSv2 sb at 318 size 203423744, last mounted on /
FFSv2 sb at 2176 size 623508480, last mounted on 
FFSv2 sb at 2240 size 623508480, last mounted on /
FFSv1 sb at 40025 size 18443881409241666161, last mounted on 
FFSv2 sb at 1519296 size 623508480, last mounted on E??????H
FFSv2 sb at 3036352 size 623508480, last mounted on 
FFSv2 sb at 4553408 size 623508480, last mounted on 
FFSv2 sb at 6070464 size 623508480, last mounted on 
FFSv1 sb at 7005534 size 10000, last mounted on 
FFSv1 sb at 7005550 size 10000, last mounted on 
FFSv2 sb at 7587520 size 623508480, last mounted on 
FFSv2 sb at 9104576 size 623508480, last mounted on 
FFSv2 sb at 10621632 size 623508480, last mounted on
FFSv2 sb at 12138688 size 623508480, last mounted on 
FFSv2 sb at 13655744 size 623508480, last mounted on 
FFSv2 sb at 15172800 size 623508480, last mounted on 
FFSv2 sb at 16689856 size 623508480, last mounted on 
FFSv2 sb at 18206912 size 623508480, last mounted on 
FFSv2 sb at 19723968 size 623508480, last mounted on 
FFSv2 sb at 21241024 size 623508480, last mounted on 
FFSv2 sb at 22758080 size 623508480, last mounted on 
FFSv2 sb at 24275136 size 623508480, last mounted on 
FFSv2 sb at 25792192 size 623508480, last mounted on 
FFSv2 sb at 27309248 size 623508480, last mounted on 
FFSv2 sb at 28826304 size 623508480, last mounted on 
FFSv1 sb at 28851269 size 18446741685369321174, last mounted on 
FFSv2 sb at 30343360 size 623508480, last mounted on tLH?????????
FFSv2 sb at 31860416 size 623508480, last mounted on 
FFSv2 sb at 33377472 size 623508480, last mounted on 
FFSv2 sb at 34894528 size 623508480, last mounted on 
FFSv2 sb at 36411584 size 623508480, last mounted on 
FFSv2 sb at 37928640 size 623508480, last mounted on 
FFSv2 sb at 39445696 size 623508480, last mounted on 
FFSv2 sb at 40962752 size 623508480, last mounted on 
FFSv2 sb at 42479808 size 623508480, last mounted on 
FFSv2 sb at 43996864 size 623508480, last mounted on
FFSv2 sb at 45513920 size 623508480, last mounted on 
FFSv2 sb at 47030976 size 623508480, last mounted on 
FFSv2 sb at 48548032 size 623508480, last mounted on 
FFSv2 sb at 47030976 size 623508480, last mounted on 
FFSv2 sb at 48548032 size 623508480, last mounted on 
FFSv2 sb at 50065088 size 623508480, last mounted on 
FFSv2 sb at 51582144 size 623508480, last mounted on 
FFSv2 sb at 53099200 size 623508480, last mounted on 
FFSv2 sb at 54616256 size 623508480, last mounted on 
FFSv2 sb at 47030976 size 623508480, last mounted on 
FFSv2 sb at 48548032 size 623508480, last mounted on 
FFSv2 sb at 50065088 size 623508480, last mounted on 
FFSv2 sb at 51582144 size 623508480, last mounted on 
FFSv2 sb at 53099200 size 623508480, last mounted on 
FFSv2 sb at 54616256 size 623508480, last mounted on 
FFSv2 sb at 56133312 size 623508480, last mounted on 

(I killed it)

---------------------

I am guessing following is different blocksize, Or I don't understand 
why doesn't match above.

localhost# newfs -N -V4 /dev/rsd4a

/dev/rsd4a: 610480.3MB (1250263728 sectors) block size 32768, fragment size 4096
	using 824 cylinder groups of 740.88MB, 23708 blks, 47104 inodes.
super-block backups (for fsck_ffs -b #) at:
        64,    1517376,    3034688,    4552000,    6069312,    7586624,
   9103936,   10621248,   12138560,   13655872,   15173184,   16690496,
  18207808,   19725120,   21242432,   22759744,   24277056,   25794368,
  27311680,   28828992,   30346304,   31863616,   33380928,   34898240,
  36415552,   37932864,   39450176,   40967488,   42484800,   44002112,
  45519424,   47036736,   48554048,   50071360,   51588672,   53105984,
  54623296,   56140608,   57657920,   59175232,   60692544,   62209856,
  63727168,   65244480,   66761792,   68279104,   69796416,   71313728,
  72831040,   74348352,   75865664,   77382976,   78900288,   80417600,
  81934912,   83452224,   84969536,   86486848,   88004160,   89521472,
  91038784,   92556096,   94073408,   95590720,   97108032,   98625344,
 100142656,  101659968,  103177280,  104694592,  106211904,  107729216,
 109246528,  110763840,  112281152,  113798464,  115315776,  116833088,
 118350400,  119867712,  121385024,  122902336,  124419648,  125936960,
 127454272,  128971584,  130488896,  132006208,  133523520,  135040832,
 136558144,  138075456,  139592768,  141110080,  142627392,  144144704,
 145662016,  147179328,  148696640,  150213952,  151731264,  153248576,
 154765888,  156283200,  157800512,  159317824,  160835136,  162352448,
 163869760,  165387072,  166904384,  168421696,  169939008,  171456320,
 172973632,  174490944,  176008256,  177525568,  179042880,  180560192,
 182077504,  183594816,  185112128,  186629440,  188146752,  189664064,
 191181376,  192698688,  194216000,  195733312,  197250624,  198767936,
 200285248,  201802560,  203319872,  204837184,  206354496,  207871808,
 209389120,  210906432,  212423744,  213941056,  215458368,  216975680,
 218492992,  220010304,  221527616,  223044928,  224562240,  226079552,
 227596864,  229114176,  230631488,  232148800,  233666112,  235183424,
 236700736,  238218048,  239735360,  241252672,  242769984,  244287296,
 245804608,  247321920,  248839232,  250356544,  251873856,  253391168,
 254908480,  256425792,  257943104,  259460416,  260977728,  262495040,
 264012352,  265529664,  267046976,  268564288,  270081600,  271598912,
 273116224,  274633536,  276150848,  277668160,  279185472,  280702784,
 282220096,  283737408,  285254720,  286772032,  288289344,  289806656,
 291323968,  292841280,  294358592,  295875904,  297393216,  298910528,
 300427840,  301945152,  303462464,  304979776,  306497088,  308014400,
 309531712,  311049024,  312566336,  314083648,  315600960,  317118272,
 318635584,  320152896,  321670208,  323187520,  324704832,  326222144,
 327739456,  329256768,  330774080,  332291392,  333808704,  335326016,
 336843328,  338360640,  339877952,  341395264,  342912576,  344429888,
 345947200,  347464512,  348981824,  350499136,  352016448,  353533760,
 355051072,  356568384,  358085696,  359603008,  361120320,  362637632,
 364154944,  365672256,  367189568,  368706880,  370224192,  371741504,
 373258816,  374776128,  376293440,  377810752,  379328064,  380845376,
 382362688,  383880000,  385397312,  386914624,  388431936,  389949248,
 391466560,  392983872,  394501184,  396018496,  397535808,  399053120,
 400570432,  402087744,  403605056,  405122368,  406639680,  408156992,
 409674304,  411191616,  412708928,  414226240,  415743552,  417260864,
 418778176,  420295488,  421812800,  423330112,  424847424,  426364736,
 427882048,  429399360,  430916672,  432433984,  433951296,  435468608,
 436985920,  438503232,  440020544,  441537856,  443055168,  444572480,
 446089792,  447607104,  449124416,  450641728,  452159040,  453676352,
 455193664,  456710976,  458228288,  459745600,  461262912,  462780224,
 464297536,  465814848,  467332160,  468849472,  470366784,  471884096,
 473401408,  474918720,  476436032,  477953344,  479470656,  480987968,
 482505280,  484022592,  485539904,  487057216,  488574528,  490091840,
 491609152,  493126464,  494643776,  496161088,  497678400,  499195712,
 500713024,  502230336,  503747648,  505264960,  506782272,  508299584,
 509816896,  511334208,  512851520,  514368832,  515886144,  517403456,
 518920768,  520438080,  521955392,  523472704,  524990016,  526507328,
 528024640,  529541952,  531059264,  532576576,  534093888,  535611200,
 537128512,  538645824,  540163136,  541680448,  543197760,  544715072,
 546232384,  547749696,  549267008,  550784320,  552301632,  553818944,
 555336256,  556853568,  558370880,  559888192,  561405504,  562922816,
 564440128,  565957440,  567474752,  568992064,  570509376,  572026688,
 573544000,  575061312,  576578624,  578095936,  579613248,  581130560,
 582647872,  584165184,  585682496,  587199808,  588717120,  590234432,
 591751744,  593269056,  594786368,  596303680,  597820992,  599338304,
 600855616,  602372928,  603890240,  605407552,  606924864,  608442176,
 609959488,  611476800,  612994112,  614511424,  616028736,  617546048,
 619063360,  620580672,  622097984,  623615296,  625132608,  626649920,
 628167232,  629684544,  631201856,  632719168,  634236480,  635753792,
 637271104,  638788416,  640305728,  641823040,  643340352,  644857664,
 646374976,  647892288,  649409600,  650926912,  652444224,  653961536,
 655478848,  656996160,  658513472,  660030784,  661548096,  663065408,
 664582720,  666100032,  667617344,  669134656,  670651968,  672169280,
 673686592,  675203904,  676721216,  678238528,  679755840,  681273152,
 682790464,  684307776,  685825088,  687342400,  688859712,  690377024,
 691894336,  693411648,  694928960,  696446272,  697963584,  699480896,
 700998208,  702515520,  704032832,  705550144,  707067456,  708584768,
 710102080,  711619392,  713136704,  714654016,  716171328,  717688640,
 719205952,  720723264,  722240576,  723757888,  725275200,  726792512,
 728309824,  729827136,  731344448,  732861760,  734379072,  735896384,
 737413696,  738931008,  740448320,  741965632,  743482944,  745000256,
 746517568,  748034880,  749552192,  751069504,  752586816,  754104128,
 755621440,  757138752,  758656064,  760173376,  761690688,  763208000,
 764725312,  766242624,  767759936,  769277248,  770794560,  772311872,
 773829184,  775346496,  776863808,  778381120,  779898432,  781415744,
 782933056,  784450368,  785967680,  787484992,  789002304,  790519616,
 792036928,  793554240,  795071552,  796588864,  798106176,  799623488,
 801140800,  802658112,  804175424,  805692736,  807210048,  808727360,
 810244672,  811761984,  813279296,  814796608,  816313920,  817831232,
 819348544,  820865856,  822383168,  823900480,  825417792,  826935104,
 828452416,  829969728,  831487040,  833004352,  834521664,  836038976,
 837556288,  839073600,  840590912,  842108224,  843625536,  845142848,
 846660160,  848177472,  849694784,  851212096,  852729408,  854246720,
 855764032,  857281344,  858798656,  860315968,  861833280,  863350592,
 864867904,  866385216,  867902528,  869419840,  870937152,  872454464,
 873971776,  875489088,  877006400,  878523712,  880041024,  881558336,
 883075648,  884592960,  886110272,  887627584,  889144896,  890662208,
 892179520,  893696832,  895214144,  896731456,  898248768,  899766080,
 901283392,  902800704,  904318016,  905835328,  907352640,  908869952,
 910387264,  911904576,  913421888,  914939200,  916456512,  917973824,
 919491136,  921008448,  922525760,  924043072,  925560384,  927077696,
 928595008,  930112320,  931629632,  933146944,  934664256,  936181568,
 937698880,  939216192,  940733504,  942250816,  943768128,  945285440,
 946802752,  948320064,  949837376,  951354688,  952872000,  954389312,
 955906624,  957423936,  958941248,  960458560,  961975872,  963493184,
 965010496,  966527808,  968045120,  969562432,  971079744,  972597056,
 974114368,  975631680,  977148992,  978666304,  980183616,  981700928,
 983218240,  984735552,  986252864,  987770176,  989287488,  990804800,
 992322112,  993839424,  995356736,  996874048,  998391360,  999908672,
1001425984, 1002943296, 1004460608, 1005977920, 1007495232, 1009012544,
1010529856, 1012047168, 1013564480, 1015081792, 1016599104, 1018116416,
1019633728, 1021151040, 1022668352, 1024185664, 1025702976, 1027220288,
1028737600, 1030254912, 1031772224, 1033289536, 1034806848, 1036324160,
1037841472, 1039358784, 1040876096, 1042393408, 1043910720, 1045428032,
1046945344, 1048462656, 1049979968, 1051497280, 1053014592, 1054531904,
1056049216, 1057566528, 1059083840, 1060601152, 1062118464, 1063635776,
1065153088, 1066670400, 1068187712, 1069705024, 1071222336, 1072739648,
1074256960, 1075774272, 1077291584, 1078808896, 1080326208, 1081843520,
1083360832, 1084878144, 1086395456, 1087912768, 1089430080, 1090947392,
1092464704, 1093982016, 1095499328, 1097016640, 1098533952, 1100051264,
1101568576, 1103085888, 1104603200, 1106120512, 1107637824, 1109155136,
1110672448, 1112189760, 1113707072, 1115224384, 1116741696, 1118259008,
1119776320, 1121293632, 1122810944, 1124328256, 1125845568, 1127362880,
1128880192, 1130397504, 1131914816, 1133432128, 1134949440, 1136466752,
1137984064, 1139501376, 1141018688, 1142536000, 1144053312, 1145570624,
1147087936, 1148605248, 1150122560, 1151639872, 1153157184, 1154674496,
1156191808, 1157709120, 1159226432, 1160743744, 1162261056, 1163778368,
1165295680, 1166812992, 1168330304, 1169847616, 1171364928, 1172882240,
1174399552, 1175916864, 1177434176, 1178951488, 1180468800, 1181986112,
1183503424, 1185020736, 1186538048, 1188055360, 1189572672, 1191089984,
1192607296, 1194124608, 1195641920, 1197159232, 1198676544, 1200193856,
1201711168, 1203228480, 1204745792, 1206263104, 1207780416, 1209297728,
1210815040, 1212332352, 1213849664, 1215366976, 1216884288, 1218401600,
1219918912, 1221436224, 1222953536, 1224470848, 1225988160, 1227505472,
1229022784, 1230540096, 1232057408, 1233574720, 1235092032, 1236609344,
1238126656, 1239643968, 1241161280, 1242678592, 1244195904, 1245713216,
1247230528, 1248747840,

They don't appear to match up with the scan_ffs -b data

I didn't try fsck_ffs -b with above
--------------------------

localhost# dumpfs sd4a
dumpfs: /dev/rsd4a: could not find superblock, skipped

-------------------------------

I am currently backing it up with

localhost# dd if=/dev/rsd4a of=/bigdisk/backup/backup-rsd4a-image bs=32k progress=10000

I had a backup at 3am of same day it crashed so lost a half day of work.
But I didn't have a backup of my /etc nor /var so I am missing some 
configs and mailbox!

Any suggestions on how I can fix the superblocks?

I may be able to recover data manually from the huge image but it will 
take me a very long time to find and piece together.

I understand disk is bad, but I am hoping some of it is still 
recoverable.
I am thinking I could grep -a for my disklabel backups but didn't do 
that yet.


Home | Main Index | Thread Index | Old Index