LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   i made a fsck and lost the system (https://www.linuxquestions.org/questions/linux-software-2/i-made-a-fsck-and-lost-the-system-4175589797/)

DRAGSTER_TUNER 09-20-2016 08:48 AM

i made a fsck and lost the system
 
4 Attachment(s)
Hi everyone...

I have 2 hds, and they are like that:

sda debian kde
sdb debian xfce + XP

Using sdb as main system, i UNMOUNt the sda and give this commmand:

fsck.ext4 /dev/sda1
tune2fs /dev/sda1

Well, after that, now sda and XP (in sdb) works, BUT XFCE in SDB does not...

Appears messages in BOTH systems...the messages that appears in both are something about READ DMA (see picture...) In sda, after a while, the system enters...in the sdb, stops in something like initramfs (see picture)


In boot, grub still shows me all systems...

As advice someone tells me to use testdisk...well, i didnt know how to use it...

Someone can help me?

rknichols 09-20-2016 09:12 AM

You have a disk with at least one bad sector. testdisk is not the right tool for dealing with that. Take a look at the smartmontools Bad Block HOWTO. From the messages in the thumbnails, sector 6146 is bad, and that is in some file in partition sdb1. I would need to see the output from "fdisk -l /dev/sdb" to proceed.

urbanwks 09-20-2016 09:32 AM

Sorry, slightly off-topic: I have to know - why two partitions just for different DEs? I'd imagine those are easily switchable within the same installation.

ondoho 09-20-2016 11:49 AM

Quote:

Originally Posted by urbanwks (Post 5607750)
Sorry, slightly off-topic: I have to know - why two partitions just for different DEs? I'd imagine those are easily switchable within the same installation.

yeah, something's really off in this thread...

DRAGSTER_TUNER 09-20-2016 05:35 PM

Hi everyone...

Ondoho: I had two different distros in different hds just for in case happens what happened...in case i lost one of them...:)

Rknichols: Here is the output:

#fdisk -l /dev/sdb
Disco /dev/sdb: 1,4 TiB, 1500301910016 bytes, 2930277168 setores
Unidades: setor de 1 * 512 = 512 bytes
Tamanho de setor (lógico/físico): 512 bytes / 512 bytes
Tamanho E/S (mínimo/ótimo): 512 bytes / 512 bytes
Tipo de rótulo do disco: dos
Identificador do disco: 0x00085ecc

Dispositivo Inicializar Início Fim Setores Tamanho Id Tipo
/dev/sdb1 * 2048 1459095551 1459093504 695,8G 83 Linux
/dev/sdb2 1459103625 2918175119 1459071495 695,8G 7 HPFS/NTFS/exFAT
/dev/sdb3 2918191104 2930276351 12085248 5,8G 82 Linux swap / Solari
root@linux2:/home/linux2#

rknichols 09-20-2016 07:12 PM

OK, let's start going through the steps in the HOWTO. Assuming that /dev/sdb1 is another ext2/3/4 filesystem (I know -- bad to assume. Is it??), run (as root)
Code:

tune2fs -l /dev/sdb1 | grep Block
If the block size is 4096, then the filesystem block for LBA 6146 is ((6146-2048)/8)=512.25. So, here's asample debugfs session with the part you type in blue:
Code:

debugfs /dev/sdb1
debugfs: testb 512
Block 512 is marked in use
debugfs: icheck 512
Block  Inode number
512    nnnnn
debugfs: ncheck nnnnn
Inode  Pathname
512    /path/to/file/with/error
debugfs: quit

For the ncheck command, copy the inode number reported by the icheck command. That will tell you what file is affected by that error and cannot be fully recovered.

Hopefully you can follow the subsequent steps in the HOWTO from there. If not, post the results from the above, and I'll try to help a bit more.

DRAGSTER_TUNER 09-21-2016 07:38 AM

Unfortunatelly, something went wrong:

# tune2fs -l /dev/sdb1 | grep Block
Block count: 182386688
Block size: 4096
Blocks per group: 32768
root@linux2:/home/linux2# debugfs /dev/sdb1
debugfs 1.42.5 (29-Jul-2012)
debugfs: testb 512
Block 512 marked in use
debugfs: icheck 512
icheck: Attempt to read block from filesystem resulted in short read while calling ext2fs_block_iterate
Block Inode number
512 <block not found>
debugfs:



Didnt find in how to this issue...



Dumb question:

what happens if i give this commands?

e2fsck -f /dev/sdb1
e2fsck -f -b 8193 /dev/sdb1 * (i dunno if i use 8193 or 16384 or 32768) in case of use this command...

rknichols 09-21-2016 09:32 AM

Quote:

Originally Posted by DRAGSTER_TUNER (Post 5608185)
debugfs: icheck 512
icheck: Attempt to read block from filesystem resulted in short read while calling ext2fs_block_iterate
Block Inode number
512 <block not found>

It appears that some of the sectors containing filesystem metadata are bad.
Quote:

what happens if i give this commands?

e2fsck -f /dev/sdb1
e2fsck -f -b 8193 /dev/sdb1 * (i dunno if i use 8193 or 16384 or 32768) in case of use this command...
Running fsck in the presence of known hardware problems is almost guaranteed to cause further damage that will probably not be recoverable.

Let's see how bad this drive might be. Post the output from
Code:

smartctl -A /dev/sdb
Please wrap that output in [CODE]...[/CODE] tags to keep it readable.

You will probably need to get another disk drive at least as large as this one and use ddrescue to make an image of the sectors that can be recovered. You can find ddrescue plus a lot of other useful tools on SystemRescueCD.

DRAGSTER_TUNER 09-21-2016 05:59 PM

Here is:

Code:

smartctl -A /dev/sdb
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.1.30-std481-amd64] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG    VALUE WORST THRESH TYPE
UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate    0x000f  099  087  051    Pre-fail
Always      -      3346
  3 Spin_Up_Time            0x0007  071  071  011    Pre-fail
Always      -      9510
  4 Start_Stop_Count        0x0032  097  097  000    Old_age
Always      -      2791
  5 Reallocated_Sector_Ct  0x0033  100  100  010    Pre-fail
Always      -      0
  7 Seek_Error_Rate        0x000f  100  100  051    Pre-fail
Always      -      0
  8 Seek_Time_Performance  0x0025  100  100  015    Pre-fail
Offline      -      0
  9 Power_On_Hours          0x0032  094  094  000    Old_age
Always      -      28093
 10 Spin_Retry_Count        0x0033  100  100  051    Pre-fail
Always      -      0
 11 Calibration_Retry_Count 0x0012  100  100  000    Old_age
Always      -      8
 12 Power_Cycle_Count      0x0032  097  097  000    Old_age
Always      -      2789
 13 Read_Soft_Error_Rate    0x000e  099  087  000    Old_age
Always      -      3346
183 Runtime_Bad_Block      0x0032  100  100  000    Old_age
Always      -      0
184 End-to-End_Error        0x0033  100  100  000    Pre-fail
Always      -      0
187 Reported_Uncorrect      0x0032  100  100  000    Old_age
Always      -      4753
188 Command_Timeout        0x0032  100  100  000    Old_age
Always      -      0
190 Airflow_Temperature_Cel 0x0022  079  051  000    Old_age
Always      -      21 (Min/Max 21/21)
194 Temperature_Celsius    0x0022  077  050  000    Old_age
Always      -      23 (Min/Max 21/23)
195 Hardware_ECC_Recovered  0x001a  100  100  000    Old_age
Always      -      198546
196 Reallocated_Event_Count 0x0032  100  100  000    Old_age
Always      -      0
197 Current_Pending_Sector  0x0012  097  097  000    Old_age
Always      -      123
198 Offline_Uncorrectable  0x0030  100  100  000    Old_age
Offline      -      0
199 UDMA_CRC_Error_Count    0x003e  100  100  000    Old_age
Always      -      0
200 Multi_Zone_Error_Rate  0x000a  100  100  000    Old_age
Always      -      0
201 Soft_Read_Error_Rate    0x000a  253  253  000    Old_age
Always      -      45

#


rknichols 09-21-2016 11:22 PM

Quote:

Originally Posted by DRAGSTER_TUNER (Post 5608463)
Code:

ID# ATTRIBUTE_NAME          FLAG    VALUE WORST THRESH TYPE    UPDATED  WHEN_FAILED RAW_VALUE
197 Current_Pending_Sector  0x0012  097  097  000    Old_age  Always      -      123


That is not good. The 123 sectors pending reallocation are ones that return an I/O error when read. There could be more bad sectors not yet marked "pending" simply because nothing has attempted to read them. That's just too many sectors to be practical to fix, one by one, by going through the steps in the HOWTO.

You need to recover as much as possible by using ddrescue to make an image onto a new disk. You could then zero out the entire disk, which should cause all the bad sectors to be remapped, and then see what shape the disk is in by looking at parameter 5, "Reallocated_Sector_Ct", but even if it's no more than the 123 known bad sectors, that is too many to consider the drive to be trustworthy. It's still worth taking a look, though. Sometimes sectors are bad due to transient conditions (vibration, power glitch) rather than physical medium faults. Those sectors become "good" (not reallocated) when they are rewritten.

Really, you should make a second copy of the image for your recovery work. At some point you're going to have to run fsck on the image, and you shouldn't be doing that on your only good copy.

DRAGSTER_TUNER 09-22-2016 08:24 AM

Hmmmmmm....

rknichols im reconsidering erase all the partition and install all debian again...its the fast and non-headache option...i already made a backup of all my files i have in that partition, so ill not lose anything.

If i install an fresh debian above this one, it will fix this blocks? or have something i have to do before install the new fresh one?

Thanx for all the support until now!

;)

rknichols 09-22-2016 09:26 AM

Quote:

Originally Posted by DRAGSTER_TUNER (Post 5608670)
If i install an fresh debian above this one, it will fix this blocks? or have something i have to do before install the new fresh one?

I still advise zeroing at least that Linux partition (sdb1) and the swap partition (sdb3). A fresh install will "sort of" fix the bad blocks. Any blocks that get written during the install will be fixed, but there could still be bad sectors in the free space pending reallocation. Bad blocks in the free space should not cause a problem (they will be written before anything tries to read them), but their possible presence makes it hard to know what the real health of the disk might be.

What is in that NTFS partition (sdb2)? If you don't want to zero that partition too, you should at least do a quick scan for bad blocks:
Code:

dd if=/dev/sdb2 of=/dev/null bs=32k conv=noerror
That will reveal how many of the 64-sector blocks contain at least one bad sector.


All times are GMT -5. The time now is 06:25 PM.