Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > uk.comp.os.linux > #20306

Re: Does it need fsck?

From Jim Price <d1version@hotmail.com>
Newsgroups uk.comp.os.linux
Subject Re: Does it need fsck?
Date 2016-10-23 19:11 +0100
Organization A noiseless patient Spider
Message-ID <nuiugd$743$1@dont-email.me> (permalink)
References <e743g4Fjmf2U1@mid.individual.net>

Show all headers | View raw


On 23/10/16 16:32, Huge wrote:
> I do my backups to SATA disks plugged into a USB dock, which works
> perfectly well for my purposes. However, the system reports that the
> backup disks require fsck (if indeed they do) when they are (auto)mounted,
> but only in /var/log/kern.log. I'd like to incorporate that functionality
> in my backup script (which I wrote).
>
> Before I sit down and do that (probably by parsing the output from
> dumpe2fs), does anyone know if there's a standard utility that will
> tell me if USB disks require fsck?

The standard utility is fsck. When used without arguments other than the 
filesystem on which to run its checks, the exit code tells you whether 
you need to give things further attention. Exit codes are:

0 – No errors
1 – Filesystem errors corrected
2 – System should be rebooted
4 – Filesystem errors left uncorrected
8 – Operational error
16 – Usage or syntax error
32 – Fsck canceled by user request
128 – Shared-library error

dumpe2fs can be used to check whether a filesystem has reached a mount 
count which would schedule an fsck at the next reboot, but that is not 
telling you anything about the actual state of the filesystem, just the 
number of mounts it has been through.

I don't know off the top of my head if any of the above is different for 
USB mounted filesystems. Also, it is normal to run fsck on an  unmounted 
filesystem (a consideration for your script if you are using an 
automounter).

-- 
    ╔═╦═╦═════╦═══╗
    ║ ║ ║     ║   ║
  ╔═╝ ║ ║ ║ ║ ║ ╔═╝
  ╚═══╩═╩═╩═╩═╩═╝  -- JimP.

Back to uk.comp.os.linux | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Does it need fsck? Huge <Huge@nowhere.much.invalid> - 2016-10-23 15:32 +0000
  Re: Does it need fsck? Huge <Huge@nowhere.much.invalid> - 2016-10-23 17:30 +0000
  Re: Does it need fsck? Jim Price <d1version@hotmail.com> - 2016-10-23 19:11 +0100
    Re: Does it need fsck? Theo <theom+news@chiark.greenend.org.uk> - 2016-10-24 09:05 +0100

csiph-web