AnswerBun.com

Ubuntu 20.04 fails to write on Hard Disk and freezes, shows "I/O error"

Ask Ubuntu Asked on December 29, 2021

When Ubuntu boots up, all is well. But when system is up for more than a few hours, the Hard Disk including root filesystem and swap partition become read-only. The GUI desktop disappears, and some messages like I/O error , Read-only filesystem etc appears and freezes without the power button. When I press power button in such sutuation some more messages popup. I am using a laptop.

Here is the screenshot of one of that times when this occured:

Screenshot when error occurred

I tried to find the cause of problem according this answer and found this:

I booted into Ubuntu 18.04 Live CD.

This is the output of fsck -f /dev/sdXX :

$ sudo fsck -f /dev/sda5
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda5: 567831/2187264 files (0.4% non-contiguous), 6372147/8728576 blocks

I also checked the return code:

$ echo $?
0

Then I rebooted and started Disks application in live CD. These are the screenshots of HDD SMART data:

HDD SMART data 1

HDD SMART data 2

Then when booted into my Ubuntu 20.04 installtion and noticed, a message like Initramfs unpacking failed: Decoding failed appeared before appearing the boot logo and disappeared within seconds.

I executed sudo grep -i FPDMA /var/log/syslog* on terminal and it gave no output.

I booted into Live CD again and executed sudo e2fsck -fccky /dev/sda5 and it gave following output:

$ sudo e2fsck -fccky /dev/sda5
e2fsck 1.44.1 (24-Mar-2018)
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: done                                                 
/dev/sda5: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sda5: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda5: 591731/2187264 files (0.4% non-contiguous), 6484554/8728576 blocks

It gave 0 return code:

$ echo $?
0

I returned to Ubuntu 20.04 and executed sudo fdisk -l which gave following output:

$ sudo fdisk -l
Disk /dev/loop0: 9.7 MiB, 9510912 bytes, 18576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 28.92 MiB, 30306304 bytes, 59192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 91.32 MiB, 95748096 bytes, 187008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 93.94 MiB, 98484224 bytes, 192352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 54.66 MiB, 57294848 bytes, 111904 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 54.97 MiB, 57618432 bytes, 112536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop6: 140.68 MiB, 147496960 bytes, 288080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop7: 140.68 MiB, 147501056 bytes, 288088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST500LM012 HN-M5
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: A85852AC-BAD1-11E9-B49D-FE4A252694FC

Device         Start       End   Sectors   Size Type
/dev/sda1       2048 843642879 843640832 402.3G Microsoft basic data
/dev/sda2  843642880 844990463   1347584   658M Windows recovery environment
/dev/sda3  844990464 865961983  20971520    10G Windows recovery environment
/dev/sda4  865961984 872089599   6127616   2.9G Microsoft basic data
/dev/sda5  904894464 974723071  69828608  33.3G Windows recovery environment
/dev/sda6  974723072 976771071   2048000  1000M EFI System
/dev/sda7  872089600 904894463  32804864  15.7G Linux filesystem

Partition table entries are not in disk order.




Disk /dev/loop8: 160.16 MiB, 167931904 bytes, 327992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop9: 255.58 MiB, 267980800 bytes, 523400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop10: 4.2 MiB, 4403200 bytes, 8600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop11: 2.45 MiB, 2555904 bytes, 4992 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop12: 14.77 MiB, 15466496 bytes, 30208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop13: 276 KiB, 282624 bytes, 552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop14: 956 KiB, 978944 bytes, 1912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop15: 956 KiB, 978944 bytes, 1912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop16: 3.66 MiB, 3825664 bytes, 7472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop17: 2.17 MiB, 2273280 bytes, 4440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop18: 62.9 MiB, 65105920 bytes, 127160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop19: 34.55 MiB, 36216832 bytes, 70736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Update:
This happens when I do excessive read and write operation on virtual hard disk. (E.g. while using virtual machine)

One Answer

Let's first check your file system...

  • boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/sda5, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot

Then let's look at the HDD SMART Data...

Start the Disks application, select your HDD, go to the "hamburger" icon and select SMART Data & Tests. Edit your question with screenshot(s) of the SMART Data.

Read/write errors. No NCQ errors.

Bad Block...

Note: do NOT abort a bad block scan!

Note: do NOT bad block a SSD

Note: backup your important files FIRST!

Note: this will take many hours

Note: 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

sudo e2fsck -fccky /dev/sda5 # non-destructive read/write test (recommended)

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.

Answered by heynnema on December 29, 2021

Add your own answers!

Related Questions

Can’t read HDD partitions from Live USB

1  Asked on January 30, 2021 by user406126

   

AMD Radeon R5 M330 error trying to use DRI_PRIME=1

0  Asked on January 29, 2021 by kevin-joshua

     

Unexpected SPC Access Width error returning to default e

0  Asked on January 28, 2021 by christophe-naud

     

Stream a recoreded Video to youtube

1  Asked on January 28, 2021 by ton-gok

     

Disable a Multimedia Key on Keyboard

0  Asked on January 28, 2021 by hell_storm2004

       

RE: Modifying bluetooth scan parameters via btmgmt

0  Asked on January 28, 2021 by mario-palumbo

   

Can I install latte dock in gnome DE?

1  Asked on January 28, 2021 by arjun-vk

     

WiFi isn’t being detected on Lubuntu 18.04

0  Asked on January 28, 2021 by cappuccino

         

Jupyter Notebook Installation

6  Asked on January 27, 2021 by karfai

         

Unable to add online accounts in the gnome control centre

0  Asked on January 27, 2021 by hoda-asif123

     

None of subtitle editors show video

1  Asked on January 27, 2021 by alex-wolf

       

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir