Re: restore super block? recover missing data?
On Sun, 20 Mar 2022, Michael van Elst wrote: > r...@reedmedia.net ("Jeremy C. Reed") writes: > > >FFSv2 sb at 2176 size 623508480, last mounted on > >FFSv2 sb at 2240 size 623508480, last mounted on / > > > One more thing. Since the first superblock is found, it might be > still ok and you only need to recover the disklabel (and handle the > bad blocks that started everything). Thank you so much (and other email too). I did a grep -a over my filesystem for a few entries I would see in my disklabel. It found source code, docs, examples. But after several hours it found four identical copies of my disklabel (from /var/backups). I used "disklabel -R sd4 J.disklabel-NEW" and was able to mount my partitions. Doing a find over them caused both of the mount points to fail. (I didn't handle the bad blocks.) I rebooted, replugged in the disk caddy, and re-mounted and was able to copy over my missing files. (Note to self: 1) make sure my backups are complete for what I need; 2) don't ignore disk errors; 3) monitor disk for SMART and disk errors.)
Re: restore super block? recover missing data?
r...@reedmedia.net ("Jeremy C. Reed") writes: >FFSv2 sb at 2176 size 623508480, last mounted on >FFSv2 sb at 2240 size 623508480, last mounted on / One more thing. Since the first superblock is found, it might be still ok and you only need to recover the disklabel (and handle the bad blocks that started everything).
Re: restore super block? recover missing data?
r...@reedmedia.net ("Jeremy C. Reed") writes: >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. There are several layers of retries that makes accessing the damaged sectors very slow. Unfortunately that's a write error. A SATA drive that cannot write a sector cannot re-allocate it either. >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 Yes. badsect tries to allocate a bad sector so that it isn't used for data. Doesn't work for meta-data blocks and doesn't work for already used blocks. >localhost# /sbin/disklabel sd4 >4 partitions: >#sizeoffset 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 That says it is a disk that is used without partitioning, unlikely to be true for a system disk. I guess 'disklabel -r' will tell that there is no label on the disk anymore. >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 / These might be candidates, but... >I am guessing following is different blocksize, Or I don't understand >why doesn't match above. You have a damaged disklabel. So 'sd4a' is the whole disk and the reported block numbers of found superblocks are absolute. Before you can access the filesystem you have to repair the disklabel (in-core, or use a wedge as a partition). It's also a different FFS version (scan_ffs found FFSv2, you checked FFSv1 layout). My guess would be: sd0a starts at block 2048, that's a common default nowadays. FFSv2 sb at 2176 size 623508480, last mounted on -> superblock at 2176-2048 = relative sector 128 FFSv2 sb at 2240 size 623508480, last mounted on / -> first backup superblock at 2240-2048 = relative sector 192 This would also fit the layout that newfs -N -V4 -O2 -s 623508480 -F /dev/null reports. >I am currently backing it up with >localhost# dd if=/dev/rsd4a of=/bigdisk/backup/backup-rsd4a-image bs=32k >progress=1 If there is a unreadable block (likely), this will abort. You can use conv=noerror,sync to ignore read errors and to replace unreadable data with null bytes. There is one more problem, dd tries to read 'bs' sized chunks. If any sector in that chunk is bad, the whole chunk is bad. You either need to use bs=512 (very slow) or try to patch up the sectors in the chunk that are still readable. In the latter case you can also use bs=1024k for maximum speed. There is 'dd_rescue' in pkgsrc that should make this simpler, but I haven't tried it.
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: 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: #sizeoffset 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 1, last mounted on FFSv1 sb at 7005550 size 1, 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?