0

Recently one of my drives refused to mount, showing the error message below:

enter image description here

Now luckily I was able to fix this thanks to another question on Ask Ubuntu that you can find here: "Structure needs cleaning" error - cannot mount partition

Basically I just had to fix the system, I entered the command:

sudo fsck.ext4 /dev/sda[NUMBER]

Just as stated in the answer to that post. That worked and everything in my drive is restored.

My question is however: How does something like this happen in the first place? I would like to know so that I can try and prevent this happening again in the future.

I'll give my setup as a guide to what I might have done wrong. I am using Ubuntu Studio 19.10. This hard drive isn't my boot drive, and neither does it contain my home partition. I have it set to mount on boot. I did this by enabling it in GNOME Disks. The drive is also formatted to ext4.

Even though I am using Xfce, I primarily use Nemo as my file manager, not Thunar.

I have it's status set to appear in my Conky, but aside from that it only gets used when I specifically run, open or save things in it. I never dismount it. When I shut my system down I just hit shutdown and normally everything is fine.

So what would cause an error like this? Is it just bad luck? Or is it something that I am doing?

Feel free to ask questions if I haven't been specific enough.

Thank you in advance :)

EDIT: Adding in requested info below.

$ cat /etc/fstab
# / was on /dev/sda1 during installation
UUID=346ba1d4-efe5-4435-87cc-178b90845c65 /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw              0       0
/dev/sdb        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
LABEL=LinuxHDD /mnt/LinuxHDD auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=LinuxHDD 0 0
$ sudo blkid
/dev/sdc1: UUID="346ba1d4-efe5-4435-87cc-178b90845c65" TYPE="ext4" PARTUUID="e437d520-01"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: LABEL="HDD 2" UUID="46A4A2A1A4A2934B" TYPE="ntfs" PARTUUID="50e732f7-01"
/dev/sdb1: LABEL="LinuxHDD" UUID="44417cbc-3321-43b1-9487-119740d01959" TYPE="ext4" PARTUUID="00033300-01"
/dev/sdd1: LABEL="System Reserved" UUID="5612B79912B77D15" TYPE="ntfs" PARTUUID="f0c3841b-01"
/dev/sdd2: UUID="86E6B86DE6B85EDD" TYPE="ntfs" PARTUUID="f0c3841b-02"
/dev/sdd3: UUID="AAD2DEECD2DEBBAF" TYPE="ntfs" PARTUUID="f0c3841b-03"
/dev/sde1: LABEL="HDD" UUID="865243EE5243E193" TYPE="ntfs" PARTUUID="37ab496d-01"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
$ sudo fdisk -l
Disk /dev/loop0: 140.8 MiB, 146882560 bytes, 286880 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: 44.18 MiB, 46325760 bytes, 90480 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: 168.46 MiB, 176631808 bytes, 344984 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: 140.32 MiB, 147128320 bytes, 287360 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: 89.9 MiB, 93417472 bytes, 182456 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: 146.5 MiB, 153600000 bytes, 300000 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: 89.1 MiB, 93429760 bytes, 182480 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: 146.54 MiB, 153649152 bytes, 300096 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: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-00B
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: dos
Disk identifier: 0x50e732f7

Device     Boot Start        End    Sectors   Size Id Type
/dev/sda1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT


Disk /dev/sdb: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: SAMSUNG HD502HJ 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00033300

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1  *     2048 976773119 976771072 465.8G 83 Linux


Disk /dev/sdc: 55.92 GiB, 60022480896 bytes, 117231408 sectors
Disk model: Corsair Force LS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe437d520

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdc1  *     2048 117229567 117227520 55.9G 83 Linux


Disk /dev/sdd: 232.91 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf0c3841b

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdd1  *         2048    718847    716800   350M  7 HPFS/NTFS/exFAT
/dev/sdd2          718848 487473151 486754304 232.1G  7 HPFS/NTFS/exFAT
/dev/sdd3       487473152 488394751    921600   450M 27 Hidden NTFS WinRE


Disk /dev/sde: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-08M
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: dos
Disk identifier: 0x37ab496d

Device     Boot Start        End    Sectors   Size Id Type
/dev/sde1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT


Disk /dev/loop8: 167.62 MiB, 175751168 bytes, 343264 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: 54.64 MiB, 57274368 bytes, 111864 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: 54.64 MiB, 57274368 bytes, 111864 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

I hope this helps!

AdLinux
  • 526
  • 2
  • 8
  • 26

1 Answers1

3

What causes a file system to become broken?

  • improper dismounts

  • access from a foreign OS (ie: Windows driver)

  • disk (pre)failure

  • main memory failure

  • stuff just happens (infrequently I hope)

Most common way to resolve broken file systems?

For 18.04 or newer...

  • boot to a Ubuntu Live DVD/USB
  • 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/sdXX, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot

note: or dismount live HDD/SSD and sudo fsck -f /dev/sdXX

In your /etc/fstab I'd recommend...

changing:

/dev/sdb        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
LABEL=LinuxHDD /mnt/LinuxHDD auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=LinuxHDD 0 0

to:

# sdb used by HDD/SSD, floppy disks probably auto mount on insertion
# /dev/sdb        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
#
# added boot time fsck (see 2 at the end of line)
# prefer UUID=44417cbc-3321-43b1-9487-119740d01959 over LABEL=LinuxHDD
UUID=44417cbc-3321-43b1-9487-119740d01959 /mnt/LinuxHDD auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=LinuxHDD 0 2
  • and adding mounts for the other two ext4 disks, and ending the line in "0 2"

Update #1:

What does ending the disks with "0 2" actually do?

From man fstab...

  The fifth field (fs_freq).
          This field is used by dump(8)  to  determine  which  filesystems
          need  to  be  dumped.   Defaults  to  zero  (don't  dump) if not
          present.

   The sixth field (fs_passno).
          This field is used by fsck(8) to determine the  order  in  which
          filesystem  checks  are  done at boot time.  The root filesystem
          should be specified with a fs_passno of  1.   Other  filesystems
          should  have  a fs_passno of 2.  Filesystems within a drive will
          be checked sequentially, but  filesystems  on  different  drives
          will  be  checked at the same time to utilize parallelism avail‐
          able in the hardware.  Defaults to  zero  (don't  fsck)  if  not
          present.
heynnema
  • 73,649