fsck.minix - Linux


Overview

fsck.minix is a Linux utility used to check and repair a Minix filesystem. It scans the filesystem for errors, such as incorrect file permissions, missing or corrupted data, and attempts to fix them to ensure the filesystem’s integrity.

Syntax

fsck.minix [options] device

Options/Flags

  • -a: Automatically repair detected errors without prompting.
  • -c: Perform a check-only operation, without attempting repairs.
  • -p: Perform a pre-flight check to identify errors but not fix them.
  • **-s`: Attempt to save as much data as possible from corrupted files.

Examples

Check and repair a Minix filesystem on /dev/sdb1:

fsck.minix /dev/sdb1

Check a filesystem without attempting repairs:

fsck.minix -c /dev/sdb1

Automatically repair errors on /dev/sda2:

fsck.minix -a /dev/sda2

Common Issues

Error message: "Bad magic number in super-block."

This error indicates that the filesystem is corrupted and cannot be accessed. Try using the -s option to recover as much data as possible.

Error message: "Missing user group number."

This error occurs when the user group number is missing from the filesystem. Use a tool like restorecon to restore the correct permissions.

Integration

Combine with blkid to identify devices:

blkid | grep minix | cut -d: -f1 | xargs -I% fsck.minix %

Use in a script to automatically check fileystems:

#!/bin/bash

# Get all Minix filesystems
filesystems=$(blkid | grep minix | cut -d: -f1)

# Check and repair each filesystem
for fs in $filesystems; do
  fsck.minix $fs
done

Related Commands

  • fsck: Checks and repairs filesystems of different types.
  • e2fsck: Checks and repairs ext2/ext3/ext4 filesystems.
  • xfs_repair: Checks and repairs XFS filesystems.