JFS Problems

I have a few boxes, with different tasks and OS installed on them. One of my personal machines had Debian installed on it till I hit a few problems, I installed Mepis, then PCLinixOS, followed by Fedora, followed by Arch, then finally back to Debian.

The box has three disks. Disk 1 / (/Root OS). Disk 2 /home. Disk 3 /data.

I always like to keep the root filesystem separate from users and data. I try to keep the OS on a separate disk or drive. After overwriting the root filesystem several times, the other volumes somehow, became corrupted.

I tried an install of Fedora 8. Still could not read the device. Tried Arch Linux, same result. Went back to Debian. Still no-go.

I googled for a solution with no luck, kept getting the same error message when I tried to mount the FS:

# mount -t jfs /dev/sdb1 /mnt/store
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

I guessed it was unclean and tried to fsck the Filesystem.

I got:

# fsck -p /dev/sdb1
fsck 1.40.6 (09-Feb-2008)
fsck: fsck.jfs: not found
fsck: Error 2 while executing fsck.jfs for /dev/sdb1

# fsck -p /dev/sdb
fsck 1.40.6 (09-Feb-2008)
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb
/dev/sdb:
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193

It dawned on me that the jfs fsck utility was not installed.

I tried to install fsck.jfs:

# aptitude install jfs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
Couldn't find package "jfs". However, the following
packages contain "jfs" in their name:
jfsutils hbf-jfs56
Couldn't find package "jfs". However, the following
packages contain "jfs" in their name:
jfsutils hbf-jfs56
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done

Next I tried:

# aptitude search jfs
p hbf-jfs56 - Chinese Jianti Fangsong 56x56 bitmap font
p jfsutils - utilities for managing the JFS filesystem

Got it!

The JFS Utils were not installed on any of the Linux' OS's I tried. Strange.

Okay, lets fix it.

Install JFS Utils:

# aptitude install jfsutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
The following NEW packages will be installed:
jfsutils
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 274kB of archives. After unpacking 1130kB will be used.
Writing extended state information... Done
Get:1 http://ftp.uk.debian.org lenny/main jfsutils 1.1.11-1 [274kB]
Fetched 274kB in 0s (386kB/s)
Selecting previously deselected package jfsutils.
(Reading database ... 121705 files and directories currently installed.)
Unpacking jfsutils (from .../jfsutils_1.1.11-1_amd64.deb) ...
Setting up jfsutils (1.1.11-1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done
Building tag database... Done

Quick check:

# jfs_fsck
jfs_fsck version 1.1.11, 05-Jun-2006
processing started: 3/23/2008 22.50.32

Error: Device not specified or command format error

Usage: jfs_fsck [-afnpvV] [-j journal_device] [--omit_journal_replay] [--replay
_journal_only] device

Emergency help:
-a Automatic repair.
-f Force check even if file system is marked clean.
-j journal_device Specify external journal device.
-n Check read only, make no changes to the file system.
-p Automatic repair.
-v Be verbose.
-V Print version information only.
--omit_journal_replay Omit transaction log replay.
--replay_journal_only Only replay the transaction log.

Alright.

Lets fix that volume.

t# jfs_fsck -p /dev/sdb1
jfs_fsck version 1.1.11, 05-Jun-2006
processing started: 3/23/2008 22.50.58
The current device is: /dev/sdb1
Block size in bytes: 4096
Filesystem size in blocks: 8970286
**Phase 0 - Replay Journal Log
Filesystem is clean.

First one done.

apache:/mnt# jfs_fsck -p /dev/sdc1
jfs_fsck version 1.1.11, 05-Jun-2006
processing started: 3/23/2008 22.51.31
The current device is: /dev/sdc1
Block size in bytes: 4096
Filesystem size in blocks: 17944597
**Phase 0 - Replay Journal Log
Filesystem is clean.

Second one done.

Mount the errant drives:

Mount -t jfs /dev/sdb1 /mnt/store

e# ls -al
total 120
drwxr-xr-x 21 root root 4096 2006-09-24 01:29 .
drwxr-xr-x 3 patrick patrick 32 2006-10-05 10:08 ..
drwxrwxrwx 2 root root 48 2006-09-18 02:44 bakups
drwxr-xr-x 6 patrick staff 4096 2006-10-05 10:46 cups
drwxr-xr-x 3 patrick staff 88 2006-10-05 10:46 fluxbox
drwxr-xr-x 3 patrick staff 8 2006-07-08 12:54 freesbie
drwxr-xr-x 2 1004 31 4096 2006-10-05 10:46 guest
drwxr-xr-x 3 patrick staff 4096 2006-10-05 10:46 java
drwxr-xr-x 2 patrick staff 96 2006-10-05 10:49 jones
drwxr-xr-x 4 1002 staff 4096 2006-10-05 10:49 oldsam
drwxr-xr-x 34 patrick staff 4096 2006-10-20 05:12 p0
drwxr-xr-x 42 patrick staff 4096 2006-10-05 10:34 p1
drwxr-xr-x 41 patrick staff 4096 2006-10-05 10:46 p2
drwxr-xr-x 23 patrick staff 4096 2006-10-05 10:49 p3
drwxr-xr-x 22 patrick staff 4096 2006-10-05 10:49 patrick
drwxr-xr-x 2 patrick staff 4096 2006-10-05 10:46 pcguest
drwxr-xr-x 11 patrick staff 4096 2006-10-05 10:49 pw
drwxr-xr-x 2 1002 staff 4096 2006-10-05 10:34 sam
drwxr-xr-x 4 patrick staff 16 2006-07-10 09:21 samba
drwxr-xr-x 2 patrick staff 4096 2006-10-05 10:46 skel
drwxrwx--- 2 root operator 1 2006-09-17 08:53 .snap

Its good.