12

In Ubuntu 12.04 I was used to run the 'Disk Utility' and choose 'Check Filesystem'; its subtitle showed also 'and repair'. In Ubuntu 16.04 I have only found the 'Disks' utility that looks similarly but has no 'Check Filesystem' option, even for the superuser.

Tomáš Pečený
  • 1,407
  • 7
  • 19
  • 45

2 Answers2

13

To check the file system on your Ubuntu partition...

  • boot to the GRUB menu
  • choose Advanced Options
  • choose Recovery mode
  • choose Root access
  • at the # prompt, type sudo fsck -f /
  • repeat the fsck command if there were errors
  • type reboot

If for some reason you can't do the above...

  • boot to a Ubuntu Live DVD/USB
  • start gparted and determine which /dev/sdaX is your Ubuntu EXT4 partition
  • quit gparted
  • open a terminal window
  • type sudo fsck -f /dev/sdaX # replacing X with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot
heynnema
  • 70,711
  • Now I urgently need to repair partitions at an USB disk and at a flash disk. I am in a great time span and I can not afford a mistake by inventing the right commands. I beg you to tell me the commands for a partition mounted as /media/my_user/kus. I hope I can still find the system identifier for the partition. Thanks! – Tomáš Pečený Oct 25 '17 at 06:36
  • I can also use Ubuntu 12.04 at an old Pentium IV PC. Some things still work OK there. Which of it do you see as a more safe? Thanks! – Tomáš Pečený Oct 25 '17 at 06:55
  • @TomášPečený the instructions that I gave should work in most situations. What part are you having difficulty with? Your USB disk, if it's an external, is probably /dev/sdb{something}, so the fsck command would be sudo fsck -f /dev/sdb{something}. – heynnema Oct 25 '17 at 13:16
  • @TomášPečenýfsck is for ext4 linux partitions. You're trying to repair a fat partition. Either you've selected the wrong partition number to fix, or you're trying to repair a problem that requires chkdsk under Windows to repair. – heynnema Oct 26 '17 at 01:14
  • Sorry, I tried to write, than hesitated how to format, but the page took it as a comment. It appears that all is OK as I will write in further at least two comments – Tomáš Pečený Oct 26 '17 at 01:46
  • After restarting the PC, i see the maybe lost files in my /dev/sdd2 external USB partition. First, I have not unmounted that partition while using the 'Disks' utility. The system answered '0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.' I have chosen 'No action'. – Tomáš Pečený Oct 26 '17 at 01:48
  • The system answered 'There are differences between boot sector and its backup. This is mostly harmless. Differences: (offset:original/backup)'. I have chosen 'No action'. Then I have unmounted it in the 'Disks' utility and repeated the 'sudo fsck -f /dev/sdd2' command. I have got '/dev/sdd2: 75173 files, 2390429/10138612 clusters' and I hope it is OK. Probably I should have closed the 'Disks' utility after I have read the partition name. – Tomáš Pečený Oct 26 '17 at 01:48
  • Among the system answers, also 'fsck from util-linux 2.27.1' and ' fsck.fat 3.0.28 (2015-05-16)' appeared and I hope that also FAT32 partition may be checked this way. – Tomáš Pečený Oct 26 '17 at 01:55
  • The question about formatting was https://meta.askubuntu.com/questions/17399/in-comments-how-to-write-blocs-of-commands – Tomáš Pečený Oct 26 '17 at 01:58
1

Just some comments:

  1. To enter the GRUB menu press and hold SHIFT while booting
  2. In Recovery Mode better to choose "fsck - Check all file systems", see picture.

enter image description here

Great description here: How to Use ‘fsck’ to Repair File System Errors in Linux

Erzi
  • 21