Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
Like Tree2Likes
Hello, I want to check for bad sectors on the hard disk in my Linux (RHEL 4.2) box, and these are the steps : a) Boot with the RHEL dvd ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Dec 2009
    Posts
    106

    Fixing a bad sector


    Hello,

    I want to check for bad sectors on the hard disk in my Linux (RHEL 4.2) box, and these are the steps :

    a) Boot with the RHEL dvd
    b) open a terminal window
    c) Type fdisk -l
    d) Type sudo e2fsck -cppv /dev/sdb2

    My question :

    1) If I do not have the RHEL 4.2 dvd, can I boot with a later version like RHEL 5.1 or 5.5?

    2) Do I have to unmount any mounted filesystem before I perform the e2fsck?

    Thanks,
    Aigini

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    1. Yes, you can boot a more recent version - try 6.3 or 6.4.
    2. Yes, you need to make sure the drive is unmounted. Booting from a live cd/dvd should not mount external drives.
    3. Login as root - you won't need to sudo to run fsck.
    4. Run fsck -cpv /dev/sdXN (sdXN is the partition to check). The fsck command will detect the file system type and deal with it appropriately. Don't double up on the 'p' option. You can add the 'f' force option if you want in case the system thinks the file system is clean.
    Lakshmipathi likes this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Newbie
    Join Date
    Jan 2013
    Posts
    116
    You could also use smartmontools and can use to detect bad blocks.

  4. #4
    Linux Newbie
    Join Date
    Dec 2009
    Posts
    106
    Does rebooting the server restore/remount unmounted partitions?

    This is because I unmounted a few partitions, and then when I rebooted the machine, I could see the devices mounted to their mount points (df -h).
    Also, is it correct to umount the "/" partition?

    # df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/hda1 15G 12G 2.4G 83% /
    /dev/hda2 15G 9.0G 4.8G 66% /LOCAL
    none 252M 0 252M 0% /dev/shm
    /dev/hdb 76G 55G 18G 76% /LOCAL2

    So the correct way to unmount the devices above are :
    #umount /
    #umount /LOCAL
    #umount /LOCAL2?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    Quote Originally Posted by NixSavy View Post
    You could also use smartmontools and can use to detect bad blocks.
    The smartmontools will not register the bad blocks with the file system to keep them from using those blocks. That's why you MUST run fsck on an unmounted file system.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    Quote Originally Posted by anaigini45 View Post
    Does rebooting the server restore/remount unmounted partitions?

    This is because I unmounted a few partitions, and then when I rebooted the machine, I could see the devices mounted to their mount points (df -h).
    Also, is it correct to umount the "/" partition?

    # df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/hda1 15G 12G 2.4G 83% /
    /dev/hda2 15G 9.0G 4.8G 66% /LOCAL
    none 252M 0 252M 0% /dev/shm
    /dev/hdb 76G 55G 18G 76% /LOCAL2

    So the correct way to unmount the devices above are :
    #umount /
    #umount /LOCAL
    #umount /LOCAL2?
    You cannot umount / when it is part of the booted image. This is why I said you need to boot from an external media such as a live CD/DVD/USB drive first. They will not mount the local file systems, so you can run fsck on them without problems. Trying to run fsck on mounted file systems can easily result in a "brick"...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Linux Newbie
    Join Date
    Dec 2009
    Posts
    106
    So do I have to boot with the cd then unmount in rescue mode??

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    Quote Originally Posted by anaigini45 View Post
    So do I have to boot with the cd then unmount in rescue mode??
    You boot with cd/dvd, fix the file systems on the hard drive without mounting them, then remove the cd/dvd and reboot your system as per normal. You should not need to umount or mount anything at that point.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Linux Newbie
    Join Date
    Dec 2009
    Posts
    106
    When I boot with the dvd, and choose Rescue mode, then this is the error that I get :

    HTML Code:
    Loading vmlinuz......
    Loading initrd.img.......................................ready.
    This kernel requires an x86_64 CPU, but only detected an i686 CPU.
    Unable to boot - please use a kernel appropriate for your CPU
    So what do I do now?
    Shall I just not boot with the dvd, and run single user mode, then unmount the filesystems, and then perform the check?

  10. #10
    Linux Newbie
    Join Date
    Jan 2013
    Posts
    116
    try to boot with 32 bit supported OS version.

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •