Browse Source

fsck: add --no-data option to do a quicker fsck

This makes it fast enough to run at startup with -f, if it's expected
that a system will frequently need to be fixed.
tags/nilmdb-1.9.2
Jim Paris 7 years ago
parent
commit
ca0943ec19
2 changed files with 8 additions and 3 deletions
  1. +5
    -2
      nilmdb/fsck/fsck.py
  2. +3
    -1
      nilmdb/scripts/nilmdb_fsck.py

+ 5
- 2
nilmdb/fsck/fsck.py View File

@@ -89,7 +89,7 @@ class Fsck(object):
### Main checks

@retry_if_raised(RetryFsck, "Something was fixed: restarting fsck")
def check(self):
def check(self, skip_data = False):
self.bulk = None
self.sql = None
try:
@@ -97,7 +97,10 @@ class Fsck(object):
self.check_sql()
self.check_streams()
self.check_intervals()
self.check_data()
if skip_data:
log("skipped data check\n")
else:
self.check_data()
finally:
if self.bulk:
self.bulk.close()


+ 3
- 1
nilmdb/scripts/nilmdb_fsck.py View File

@@ -16,10 +16,12 @@ def main():
parser.add_argument("-f", "--fix", action="store_true",
default=False, help = 'Fix errors when possible '
'(which may involve removing data)')
parser.add_argument("-n", "--no-data", action="store_true",
default=False, help = 'Skip the slow full-data check')
parser.add_argument('database', help = 'Database directory')
args = parser.parse_args()

nilmdb.fsck.Fsck(args.database, args.fix).check()
nilmdb.fsck.Fsck(args.database, args.fix).check(skip_data = args.no_data)

if __name__ == "__main__":
main()

Loading…
Cancel
Save