OpenWRT SSD or USB or Disk Maintenance

Wiki.TerraBase.info
Revision as of 10:55, 27 October 2022 by Root (talk | contribs)
Jump to navigation Jump to search

This article is about disk maintenance on an OpenWRT SSD, USB Flash Drive, or Disk Drive. It assumes all utilities needed are installed (see for more information). It also deals only with EXT4 volumes as it is easier to pull an SSD, USB Flash Drive, Disk Drive, etc., connect it to a Windows computer and scan it that way.

  • View Information on an EXT4 Partition / Volume: tune2fs -l /dev/sda1
  • Only print the line about "Last checked": tune2fs -l /dev/sda1 | grep Last\ checked (the \ (backslash) being used as an escape character for the space)
  • Set Maximum Mount Count to 1: tune2fs -c 1 /dev/sda1

Automatic Scanning of /Overlay Partitions

Just like the brightness knobs on old fashion CRT based TVs, it don't work (Gallagher joke there). Really, it doesn't work. Go ahead and try it. In the /etc/config/fstab File, set it as below;

config global
        option anon_swap '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '1'
        option anon_mount '1'

config mount
        option target '/overlay'
        option uuid 'WhatEverUUID'
        option fstype 'ext4'
        option enabled_fsck '1'
        option enabled '1'

One would think that an EXT4 partition would be checked with the above setting. Nope, no such luck. shutdown -rF now (yea, right, err, no way).

More Issues

The tune2fs on OpenWRT will probably not correctly report whether an EXT4 volume is clean or not. This was tested by using the Advanced Power Off from the LuCI GUI, taking the USB Flash Drive being used as an /Overlay partition and plugging it into a RockyOS 8.6 computer, running fsck -vf /dev/WhatEverSDnumber, then checking the status with tune2fs -l /dev/WhatEverSDnumber, and having it show as "Filesystem state: clean", unmounting it, putting it back in the WRT32X router, running the tunefs2 utility while it was booted from and had the partition in question mounted, and guess what? "Filesystem state: not clean". Then shut the router down again, took the USB Flash Drive and plugged it into the Rocky OS system, ran the tune2fs utility and it was 'clean' (without running fsck again). Back to the WRT32X router, and it is 'suddenly' 'not clean'. Oh, and it shows the 'Last checked' date and time as being just a couple of minutes ago on the last tune2fs check. What gives OpenWRT???

Sources

Information on this article was sourced from various websites. This one provides 'general' (non OpenWRT specific) information on the subject: https://linuxconfig.org/how-to-force-fsck-to-check-filesystem-after-system-reboot-on-linux