4

My hard drive is partly visible (only 4.1 GB of 2TB) in "Disks" and has a bad sector. I have tried using the smartmontools to check for bad sectors and then used badblocks -svn /dev/sda for which I get the response

badblocks: Permission denied while trying to determine device size

Then I tried to use installation utility but the 18.04 LTS stops responding at selecting language.

error starting SMART self test

"Disk is OK, one bad sector"

Edit 3: New development in the issue - the live usb has started to become unresponsive/ freezing.

Edit 4: using the method provided by 1st answer I am getting the error shown:

Gparted: input/output error during read of /dev/sda

error fsyncing/closing /dev/sda

fdisk output - can't see the disk

Zanna
  • 72,471
Someone.
  • 91
  • 1
  • 1
  • 5
  • This doesn't look very good. I hope you have good backups. Go ahead and try doing my answer. Report back. I'm going to bed now, but send me a comment, and I'll return in the morning. – heynnema Sep 27 '20 at 02:56
  • Hey @heynnema, I tried your method but it didn't work. I have added an image for it. Right now I have installed 20.04 LTS on another drive and tried to repeat the smart scan process, but the result was same and there is some error related to input/output of the disk. – Someone. Sep 27 '20 at 11:11
  • You gave it an incorrect command. It's not /dev/sda. Please re-read my instructions and report back. – heynnema Sep 27 '20 at 12:13
  • The commands given that you provided did not return a number for that hard drive. Please, is there any other way ? @heynnema – Someone. Sep 27 '20 at 15:43
  • Show me the output of the sudo fdisk -l command. Do you have backups of the data on this drive... or do you, at this point, care about anything on this drive? If not, we'll lay down a fresh GPT partition table (this will wipe the drive), then we'll install a fresh ext4 partition, then we'll bad block it. – heynnema Sep 27 '20 at 15:55
  • Added both the screenshots. I don't care about the data as it was used in surveillance and I was installing OS on it for first time. Some error occurred saying the disk cannot be formatted and then suddenly disk started behaving like this. @heynnema – Someone. Sep 27 '20 at 16:16
  • Right now it's night time in my time zone so I can respond after about 8 to 10 hours. Thank you in advance. @heynnema – Someone. Sep 27 '20 at 16:18
  • It looks like you tried to install a fresh GPT partition table, yes? And it failed, yes? If both answers are "yes", try laying down a MBR partition table, and see what happens. It doesn't look good... the drive may be gone. Funny enough "fdisk" sees partition sdb1 and sdb2, which theoretically should be able to bad block... but maybe not. Did fsck run on sdb1 and sdb2? Report back later. – heynnema Sep 27 '20 at 16:49
  • The sdb1 and sdb2 are from another drive where 20.04LTS is installed. So fdisk is not able to detect the drive. And there is an IDE Slave drive error in BIOS. Right now my computer is not even turning ON when I connect the drive with bad sector.@heynnema – Someone. Sep 28 '20 at 02:43
  • Ah! Anyway, the drive is bad. Toss it. Replace it. – heynnema Sep 28 '20 at 02:46
  • A thought just struck me... this is a SATA drive, correct? If not, are you sure the master/slave/cable select jumpers are correctly set? – heynnema Sep 28 '20 at 02:49
  • Yes it's a SATA and not ATA. @heynnema – Someone. Sep 28 '20 at 02:52
  • I saw your comment about IDE Slave drive error... and it made me think. Oh well, toss the drive. – heynnema Sep 28 '20 at 02:53
  • Or see if there's any Seagate warranty left. – heynnema Sep 28 '20 at 02:54
  • I hope it gets covered in warranty as manufacturing year is 2016. Thanks for your patience though. @heynnema – Someone. Sep 28 '20 at 03:02
  • If my answer, and the comments, have been helpful, please remember to accept my answer by clicking on the checkmark icon that appears just to the left of my answer. Thanks! – heynnema Sep 28 '20 at 14:34
  • Status please... – heynnema Oct 02 '20 at 02:39
  • Status please... – heynnema Oct 04 '20 at 16:34
  • Hi , How did you fix it finally? I have the same issue in my SSD and answer didnt help me! – Parisa.H.R Feb 26 '24 at 10:44

2 Answers2

6

The Disks, fdisk, and gparted screenshots don't look very promising...

fsck

First check your file system.

  1. Boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  2. Open a terminal window by pressing Ctrl+Alt+T
  3. Type sudo fdisk -l
  4. Identify the /dev/sdXX device name for your "Linux Filesystem"
  5. Type sudo fsck -f /dev/sdXX, replacing sdXX with the number you found earlier
  6. Repeat the fsck command if there were errors
  7. Type reboot

bad block

Notes

  • Do NOT abort a bad block scan!
  • Do NOT bad block a SSD
  • Backup your important files FIRST!
  • This will take many hours
  • You may have a pending HDD failure

Boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode.

In terminal:

sudo fdisk -l  # identify all "Linux Filesystem" partitions
sudo e2fsck -fcky /dev/sdXX # read-only test

or

non-destructive read/write test (recommended):

sudo e2fsck -fccky /dev/sdXX

The -k is important, because it saves the previous bad block table, and adds any new bad blocks to that table. Without -k, you loose all of the prior bad block information.

The -fccky parameter...

   -f    Force checking even if the file system seems clean.

-c This option causes e2fsck to use badblocks(8) program to do a read-only scan of the device in order to find any bad blocks. If any bad blocks are found, they are added to the bad block inode to prevent them from being allocated to a file or direc‐ tory. If this option is specified twice, then the bad block scan will be done using a non-destructive read-write test.

-k When combined with the -c option, any existing bad blocks in the bad blocks list are preserved, and any new bad blocks found by running badblocks(8) will be added to the existing bad blocks list.

-y Assume an answer of `yes' to all questions; allows e2fsck to be used non-interactively. This option may not be specified at the same time as the -n or -p options.

Update

The HDD is defective. Replace it. It may still be under warranty. Check with Seagate.

Pablo Bianchi
  • 17,552
heynnema
  • 73,937
  • 1
    Why do you not badblocks an SSD? Anything dangerous or would it mean simply wasting write operations to do something SSDs already do by themselves? – Don Joe Aug 05 '23 at 13:14
  • @DonJoe The answer to that question is kind of involved. Google it. – heynnema Aug 05 '23 at 14:21
2

Conclusion: The Hard Drive is destroyed ( useless and cannot be repaired ). So if anyone one is facing similar problem, check if any solution mentioned in the comments work for you or ask a new question on the forum.

Someone.
  • 91
  • 1
  • 1
  • 5