LinHES Forums
http://forums.linhes.org/

XFS maintenance - read if you're new to XFS
http://forums.linhes.org/viewtopic.php?f=3&t=18601
Page 1 of 1

Author:  graysky [ Sun Jul 20, 2008 12:33 pm ]
Post subject:  XFS maintenance - read if you're new to XFS

First off, here are two related threads for those of us new to XFS:

How and why - create an XFS partition
How to defragment XFS partitions and keep them that way

You must periodically check your XFS partition(s) for error manually since fsck will NOT run automatically as it does with your ext3 partition(s).

There are two utils on your system to do this: xfs_check and xfs_repair

Checking for Inconsistencies
Note that you MUST unmount your XFS partition to use either of these. Do NOT run either of them on a mounted filesystem! In my system, only my /myth is XFS (it is /dev/hda3). In order to unmount your partition, you must exit myth-frontend since it'll be using it.

After you exited the frontend and/or mythwelcome, drop into single user mode and umount your partition (again mine is /dev/hda3 but substitute your XFS partition for hda3):

Code:
# telinit 1
# umount /dev/hda3


If you get a "umount: /myth: device is busy" error, do this:

Code:
$ fuser -m /dev/hda3
/dev/hda3:            3560


Mine returned one process (3560) using it. You can see what it is by issueing the following:
Code:
$ ps auxw|grep 3560
mythtv    3560  4.5 11.1 164128 53660 ?        SLl  14:17   0:03 mythfrontend
mythtv    3594  0.0  0.1   1780   596 ttyp0    S+   14:19   0:00 grep 3560


It's mythfrontend (I didn't exit to illustrate this point). I killed it using the kill command followed-up a umount:
Code:
# kill 3560
# umount /dev/hda3


Now you can run xfs_check or xfs_repair safely
Code:
# xfs_check /dev/hda3
# xfs_check /dev/hda3


If there is nothing wrong with the file system, you won't see anything. From the xfs_check man page"
Quote:
Any output that is produced when xfs_check is not run in verbose mode indicates that the filesystem has an inconsistency.


If you get no errors, just mount the partition and return to multiuser mode.

Code:
# mount /dev/hda3
# telinit 5
$ pkill xinit


Attempt to Repair Inconsistencies

Again, ONLY do the following on an unmounted partition!

If you do get errors, you can run xfs_repair:
Code:
# xfs_repair /dev/hda3
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done


In my case, I had no errors, but wanted to show you the output of xfs_repair. So all is well. Now go back and remount your /dev/hda3 and swtich back to multiuser mode and finally restart your frontend with a pkill xinit:
Code:
# mount /dev/hda3
# telinit 5
$ pkill xinit


Please see the man page for xfs_repair for a more detailed description of those Phases (referenced below).

References
docs.cray.com - Checking XFS File System Consistency with xfs_check and xfs_repair
linux.die.net - man page for xfs_check and man page for xfs_repair
ocaoimh.ie - How to umount when the device is busy

Author:  tjc [ Sun Jul 20, 2008 4:20 pm ]
Post subject:  Re: XFS maintenance - read if you're new to XFS

graysky wrote:
You must periodically check your XFS partition(s) for error manually since fsck will NOT run automatically as it does with your ext3 partition(s).

Well that's the best reason I've heard yet not to use XFS. Any FS developer who can't be bothered to make their FS utilities plug into the _very_ general and standard fsck framework just doesn't know how to play well with others. WTH were they thinking? :?

Author:  graysky [ Sun Jul 20, 2008 4:43 pm ]
Post subject: 

I could be mistaken, but I read this in several places including within fsck when I attempted to use it on that partition:
Code:
fsck /dev/hda3
fsck 1.40.6 (09-Feb-2008)
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_check(8) and xfs_repair(8).


I was a bit surprised when I read this myself. But since I already made the entire /myth XFS I don't really care at this point. That said, from what I've read, either JFS or XFS are the recommended FS's to use when dealing with large files.

Author:  tjc [ Sun Jul 20, 2008 5:13 pm ]
Post subject: 

I'd already done that investigation myself and verified that it was indeed the case. My response was as much an exclamation of disgust and annoyance with developers who can't be bothered to follow standards as anything.

This is like a stereo receiver which requires some bizarre custom connectors instead any of the standard types (RCA phone, bare wire, banana plugs, ...) You'd take one look and say "WTH were they thinking?!?" and spend your money elsewhere if you weren't a total tech victim. http://ars.userfriendly.org/cartoons/?id=20080618

Author:  graysky [ Sun Jul 20, 2008 5:34 pm ]
Post subject: 

@tjc - too right!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/