Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Accidently unplugged HDD while running

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
useless
Posts: 7
Joined: 2021-12-06 05:54
Been thanked: 1 time

Accidently unplugged HDD while running

#1 Post by useless »

Hi

I installed Debian into a Western Digital HDD drive. This is attached to my Thinkpad using a USB-SATA cable.

I was using only the console to decrypt some files...when someone knocked off the HDD, and it got unplugged.
The screen showed a bunch of wierd messages. So, I panicked and immedicately powered off the Thinkpad.
At the time, I think nothing is running except the terminal console. I think the decryption was already completed.

But I have this fear that somewhere there might be a corrupted file that is very important to me.

Is there a way to do a health checkup of the HDD drive?

I recall reading something you have to do, if you did not cleanly shutdown Linux.

Thanks!


useless
Posts: 7
Joined: 2021-12-06 05:54
Been thanked: 1 time

Re: Accidently unplugged HDD while running

#3 Post by useless »

It seems to boot and run fine.

But, when I do "fsck", I get some kind of error message...

Code: Select all

# sudo fsck /dev/sda
fsck from util-linux 2.36.1
e2fsck 1.46.2 (28-Feb-2021)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda

The superblock could not be read or does not describe a valid ext2/ext3/ext4 
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filessystem (and not swap or ufs or something else), then the superblock 
is corrupt, and you might try running e2fsck with an alternate superblock:
   e2fsck -b 8193 <device>
or
  e2fsck -b 32768 <device>

Found a dos partition table in /dev/sda

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Accidently unplugged HDD while running

#4 Post by p.H »

Expected. You must run fsck on a device (usually a partition) which contains an unmounted filesystem, not a whole drive which contains a partition table.

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2065
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: Accidently unplugged HDD while running

#5 Post by FreewheelinFrank »

What partitions are on the hard drive? Is there a Windows partition? What is the laptop running?

useless
Posts: 7
Joined: 2021-12-06 05:54
Been thanked: 1 time

Re: Accidently unplugged HDD while running

#6 Post by useless »

FreewheelinFrank wrote: 2021-12-06 16:39 What partitions are on the hard drive? Is there a Windows partition? What is the laptop running?
Theres only two partitions in the HDD: an ext4 and a swap.

Theres no Windows in this HDD. This HDD only has Debian.

I am not doing dual boot.

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2065
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: Accidently unplugged HDD while running

#7 Post by FreewheelinFrank »

What about the laptop? Does it have its own storage device? Are you trying Debian from the HD in addition to an OS on the laptop, or is the storage on the laptop missing/broken and the laptop booting from the HD?

Edit: in another thread you say you're dual booting the laptop - is that on an internal drive? Why did you install Debian to an external drive as well?

useless
Posts: 7
Joined: 2021-12-06 05:54
Been thanked: 1 time

Re: Accidently unplugged HDD while running

#8 Post by useless »

FreewheelinFrank wrote: 2021-12-07 08:15 What about the laptop? Does it have its own storage device? Are you trying Debian from the HD in addition to an OS on the laptop, or is the storage on the laptop missing/broken and the laptop booting from the HD?

Edit: in another thread you say you're dual booting the laptop - is that on an internal drive? Why did you install Debian to an external drive as well?
Sorry about the confustion.

So, when I started this thread, I had Windows-10 in the Kingston SSD drive (which is inside my Thinkpad). My Thinkpad inside has only space for 1 drive.
So, I installed Debian in a WD HDD drive (which is outside and connected to my Thinkpad's USB port via a USB-SATA cable).

When I started this thread, I was not doing dual-boot. As I understand, dual-boot means having more than 1 O.S. in a hard drive.
So, I had Win-10 in my Kingston SSD, and I had Debian in my WD HDD. So, not dual-booting.

After accidentally unplugging the HDD's USB cable, I made this thread and then did fsck per instruction.

After that, I decided I did not want to run Debian on an external drive anymore. I reinstalled Debian, but this time, I put it into my Kingston SSD along side Win-10. So now I am dual-booting. I had a question about Grub, so that is why I have another post about dual-booting.

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2065
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: Accidently unplugged HDD while running

#9 Post by FreewheelinFrank »

No problem. Just trying to understand why the scan didn't work.

It looks like you were trying to run fsck from Debian booting from the HD to scan the HD, which was not going to work, as p.H posted.

You could now scan the HD from Debian booting from the SSD, I think, but the issue may well have sorted itself out: modern Linux file systems know if the file system is "dirty" from the journal, and run fsck at boot if it is. Years ago Debian used to run fsck at boot every 30 boots or so, but today it doesn't, presumably because the modern journal is so good at recognising when there is a problem.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Accidently unplugged HDD while running

#10 Post by p.H »

FreewheelinFrank wrote: 2021-12-08 09:26 Just trying to understand why the scan didn't work.
Isn't it obvious enough ? fsck failed because it was run on the wrong device (whole drive instead of a filesystem).

Post Reply