# Solvedfsck -y /dev/ada2 ---> Cannot find file system superblock.

#### ziomario

Hello.

please check the situation below. I think that one of my disks is damaged,but I don't realize how much.

Code:
``````mario@marietto:/home/marietto # gpart show

=>       40  625142368  ada2  GPT  (298G)
40     532480     1  efi  (260M)
532520  616030208     2  freebsd-ufs  (294G)
616562728    8388608     3  freebsd-swap  (4.0G)
624951336     191072        - free -  (93M)

mount: /dev/ada2p2: No such file or directory

Cannot find file system superblock
Cannot find file system superblock

Cannot find file system superblock
Cannot find file system superblock``````

Can I make something to recover the data inside this disk or the only operation that I can do is to recreate the partition table and reinstall everything from scratch ?

#### Zirias

from fsck_ffs(8):
Code:
``````     -b      Use the block specified immediately after the flag as the super
block for the file system.  An alternate super block is usually
located at block 32 for UFS1, and block 192 for UFS2.``````

If this doesn't help, my guess would be you're doomed...

edit, concerning this: `# fsck -y /dev/ada2`NEVER attempt to run fsck on a disk (at least if it's actually partitioned).

#### SirDice

Staff member
Moderator
It's also possible that freebsd-ufs partition isn't formatted with UFS. Just because the partition type indicates UFS doesn't dictate that the actual filesystem used is UFS. You can just as easily run newfs_msdos(8) on a freebsd-ufs partition.

OP

#### ziomario

from fsck_ffs(8):
Code:
``````     -b      Use the block specified immediately after the flag as the super
block for the file system.  An alternate super block is usually
located at block 32 for UFS1, and block 192 for UFS2.``````

If this doesn't help, my guess would be you're doomed...

edit, concerning this: `# fsck -y /dev/ada2`NEVER attempt to run fsck on a disk (at least if it's actually partitioned).

like this ?

Code:
``fsck -y -b "how can I calculate the value of b here ?" /dev/ada2p2``

#### SirDice

Staff member
Moderator
"how can I calculate the value of b here ?"
It says it right there, in that same bit of quoted man page.

An alternate super block is usually located at block 32 for UFS1, and block 192 for UFS2.

OP

#### ziomario

It's also possible that freebsd-ufs partition isn't formatted with UFS. Just because the partition type indicates UFS doesn't dictate that the actual filesystem used is actually UFS.

Code:
``````mario@marietto:/home/marietto # fdisk /dev/ada2p2 | grep sysid

fdisk: invalid fdisk partition table found
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)``````

OP

#### ziomario

Code:
``````mario@marietto:/home/marietto # fsck -y -b 192 /dev/ada2p2
fsck: illegal option -- b``````

OP

#### ziomario

Code:
``````mario@marietto:/home/marietto # fsck_ufs -y -b 192 /dev/ada2p2

Alternate super block location: 192
192 is not a file system superblock
192 is not a file system superblock``````

OP

#### ziomario

Is there anything else that I can try ? Should I reinstall FreeBSD from scratch ?

#### Zirias

Is there anything else that I can try ?
If this doesn't help, my guess would be you're doomed...
That is, as SirDice said, if you're sure this partition should contain an UFS.

Should I reinstall FreeBSD from scratch ?
You might want to use ZFS. Not that UFS was completely fragile, but ZFS has a lot more features for resilience.

But then, in case you have no idea what might have caused that trouble, better check the drive (e.g. SMART data), it might be dying (or already dead).

To locate the next superblock you can use newfs with "-N" so it will only print the list of the superblocks which are going to be created without actually formatting the partition.

` newfs -N /dev/ada2p2`
!!! don't miss the capital -N !!!

When you get the list of the superblock you can try
` fsck_ffs -b 1280640 /dev/ada2p2`
where the 1280640 is the next superblock backup

You can also try ` fstyp /dev/ada2p2` to see if the UFS is detected

OP

#### ziomario

Code:
``````mario@marietto:/home/marietto # newfs -N /dev/ada2p2

/dev/ada2p2: 300796.0MB (616030208 sectors) block size 32768, fragment size 4096
using 482 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:

192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568, 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944, 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320, 47376768,
48657216, 49937664, 51218112, 52498560, 53779008, 55059456, 56339904, 57620352, 58900800, 60181248, 61461696, 62742144, 64022592, 65303040, 66583488, 67863936, 69144384, 70424832, 71705280, 72985728, 74266176, 75546624, 76827072, 78107520, 79387968, 80668416, 81948864, 83229312, 84509760, 85790208, 87070656, 88351104, 89631552, 90912000, 92192448, 93472896,
94753344, 96033792, 97314240, 98594688, 99875136, 101155584, 102436032, 103716480, 104996928, 106277376, 107557824, 108838272, 110118720, 111399168, 112679616, 113960064, 115240512, 116520960, 117801408, 119081856, 120362304, 121642752, 122923200, 124203648, 125484096, 126764544, 128044992, 129325440, 130605888, 131886336, 133166784, 134447232, 135727680, 137008128, 138288576, 139569024, 140849472, 142129920, 143410368, 144690816, 145971264, 147251712, 148532160, 149812608, 151093056, 152373504, 153653952, 154934400, 156214848, 157495296, 158775744, 160056192, 161336640, 162617088, 163897536, 165177984, 166458432, 167738880, 169019328, 170299776, 171580224, 172860672, 174141120, 175421568, 176702016, 177982464, 179262912, 180543360, 181823808, 183104256, 184384704, 185665152, 186945600, 188226048, 189506496, 190786944, 192067392, 193347840, 194628288, 195908736, 197189184, 198469632, 199750080, 201030528, 202310976, 203591424, 204871872, 206152320, 207432768, 208713216, 209993664, 211274112, 212554560, 213835008, 215115456, 216395904, 217676352, 218956800, 220237248, 221517696, 222798144, 224078592, 225359040, 226639488, 227919936, 229200384, 230480832, 231761280, 233041728, 234322176, 235602624, 236883072, 238163520, 239443968, 240724416, 242004864, 243285312, 244565760, 245846208, 247126656, 248407104, 249687552, 250968000, 252248448, 253528896, 254809344, 256089792, 257370240, 258650688, 259931136, 261211584, 262492032, 263772480, 265052928, 266333376, 267613824, 268894272, 270174720, 271455168, 272735616, 274016064, 275296512, 276576960, 277857408, 279137856, 280418304, 281698752, 282979200, 284259648, 285540096, 286820544, 288100992, 289381440, 290661888, 291942336, 293222784, 294503232, 295783680, 297064128, 298344576, 299625024, 300905472, 302185920, 303466368, 304746816, 306027264, 307307712, 308588160, 309868608, 311149056, 312429504, 313709952, 314990400, 316270848, 317551296, 318831744, 320112192, 321392640, 322673088, 323953536, 325233984, 326514432, 327794880, 329075328, 330355776, 331636224, 332916672, 334197120, 335477568, 336758016, 338038464, 339318912, 340599360, 341879808, 343160256, 344440704, 345721152, 347001600,
348282048, 349562496, 350842944, 352123392, 353403840, 354684288, 355964736, 357245184, 358525632, 359806080, 361086528, 362366976, 363647424, 364927872, 366208320, 367488768, 368769216, 370049664, 371330112, 372610560, 373891008, 375171456, 376451904, 377732352, 379012800, 380293248, 381573696, 382854144, 384134592, 385415040, 386695488, 387975936, 389256384, 390536832, 391817280, 393097728, 394378176, 395658624, 396939072, 398219520, 399499968, 400780416, 402060864, 403341312, 404621760, 405902208, 407182656, 408463104, 409743552, 411024000, 412304448, 413584896, 414865344, 416145792, 417426240, 418706688, 419987136, 421267584, 422548032, 423828480, 425108928, 426389376, 427669824, 428950272, 430230720, 431511168, 432791616, 434072064, 435352512, 436632960, 437913408, 439193856, 440474304, 441754752, 443035200, 444315648, 445596096, 446876544, 448156992, 449437440, 450717888, 451998336, 453278784, 454559232, 455839680, 457120128, 458400576, 459681024, 460961472, 462241920, 463522368, 464802816, 466083264, 467363712, 468644160, 469924608, 471205056, 472485504, 473765952,
475046400, 476326848, 477607296, 478887744, 480168192, 481448640, 482729088, 484009536, 485289984, 486570432, 487850880, 489131328, 490411776, 491692224, 492972672, 494253120, 495533568, 496814016, 498094464, 499374912, 500655360, 501935808, 503216256, 504496704, 505777152, 507057600, 508338048, 509618496, 510898944, 512179392, 513459840, 514740288, 516020736, 517301184, 518581632, 519862080, 521142528, 522422976, 523703424, 524983872, 526264320, 527544768, 528825216, 530105664, 531386112, 532666560, 533947008, 535227456, 536507904, 537788352, 539068800, 540349248, 541629696, 542910144, 544190592, 545471040, 546751488, 548031936, 549312384, 550592832, 551873280, 553153728, 554434176, 555714624, 556995072, 558275520, 559555968, 560836416, 562116864, 563397312, 564677760, 565958208, 567238656, 568519104, 569799552, 571080000, 572360448, 573640896, 574921344, 576201792, 577482240, 578762688, 580043136, 581323584, 582604032, 583884480, 585164928, 586445376, 587725824, 589006272, 590286720, 591567168, 592847616, 594128064, 595408512, 596688960, 597969408, 599249856, 600530304,
601810752, 603091200, 604371648, 605652096, 606932544, 608212992, 609493440, 610773888, 612054336, 613334784, 614615232, 615895680

mario@marietto:/home/marietto # fsck_ffs -b 192 /dev/ada2p2

Alternate super block location: 192
192 is not a file system superblock
192 is not a file system superblock

ext2fs``````

ext2fs ?????? what happened bro ?????

OP

#### ziomario

Code:
``````mario@marietto:/home/marietto # mount -t ext2fs /dev/ada2p2 /mnt/ada2p2

android-2.1.0   lost+found

data            initrd.img      kernel          system.img``````

I really don't know what happened. But at this point I suppose that I've lost every data inside that partition. But why is it still marked as ufs ?

The partition type is stored in gpt and it doesn't matter how you formatted it. At least you know that this partition file system is ext2.

OP

#### ziomario

No man,I never formatted it using the ext2 fs. In that disk there is FreeBSD since a long time with the UFS2 fs. I'm sad.