How to Defragment Linux JFS

How to Defragment Linux JFS thumbnail
The Journaled File System was originally created by IBM.

All file systems are subject to some level of fragmentation. Most computers that run the Linux operating system do not need defragmenting because the file system has defragmentation codes in place to prevent fragmentation from occurring. One of the file systems you can install for Linux is the Journaled File System (JFS). JFS was originally ported from the OS/2 operating system, so the defragmentation codes that are in place do not entirely correct fragmentation issues within Linux. You will need to manually defragment JFS to increase system performance.

Instructions

    • 1

      Log in to Linux as root.

    • 2

      Open a terminal window within Linux.

    • 3

      Type the script below into the terminal window:

      umount /dev/hdc1

      dd bs=4k if=/dev/hdc1 of=/dev/hdj1

      jfs_fsck /dev/hdj1

      mount -o ro /dev/hdj1 /fs/hdj1

      jfs_mkfs /dev/hdc1

      mount -o rw /dev/hdc1 /fs/hdc1

      (cd /fs/hdj1 && tar -cS -b8 --one -f - .) | (cd /fs/hdc1 && tar -xS -b8 -p -f -)

      umount /dev/hdj1

      This script will unmount your hard drive, save the data on your hard drive and format the hard drive. Your data will then be copied back to your hard drive without fragmentation and the drive will be re-mounted. This is the only way to properly defragment your hard drive when using JFS.

Tips & Warnings

  • You must type the script in correctly without errors or you will risk wiping your entire hard drive without a chance for recovery.

Related Searches:
  • Photo Credit Hemera Technologies/Photos.com/Getty Images

Comments

You May Also Like

  • How to Defrag in Linux

    The files on a hard-disk drive can become fragmented, or written in random blocks. Fragmentation can slow performance, so defragmentation is a...

  • How to Purify a Memory Leak

    A memory leak occurs when a computer program consumes memory but cannot release it back to the operating system. A leak can...

Related Ads

Featured