Solved

How to fsck a mounted raid device /dev/md2 ?

Posted on 2013-01-01
7
2,315 Views
Last Modified: 2016-12-08
Hi,

I would like to request an assistant.

It seems that my /var/log/messages having the following error message :

Jan  1 11:24:26 srv9 kernel: raid1: sdb: unrecoverable I/O read error for block 286895360

My cat /proc/mdstat shows as follows :

root@srv9 [~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
      104320 blocks [2/2] [UU]

md1 : active raid1 sdb2[1] sda2[0]
      2096384 blocks [2/2] [UU]

md2 : active raid1 sda3[2](S) sdb3[1]
      310367680 blocks [2/1] [_U]


My mdadm --detail /dev/md2 shows as follows :

root@srv9 [/]# mdadm --detail /dev/md2
/dev/md2:
        Version : 0.90
  Creation Time : Fri May 30 17:11:49 2008
     Raid Level : raid1
     Array Size : 310367680 (295.99 GiB 317.82 GB)
  Used Dev Size : 310367680 (295.99 GiB 317.82 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Tue Jan  1 23:24:58 2013
          State : clean, degraded
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

           UUID : 273f6c1b:0e438923:11f1305b:25e0df37
         Events : 0.9388326

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8       19        1      active sync   /dev/sdb3

       2       8        3        -      spare   /dev/sda3



SUMMARY
=========


1. /var/log/messages shows sdb which having the error.
2. /proc/mdstat shows sda3[2](S) device which is degraded and becoming spare.
3. /dev/sdb3 is my actual /dev/md2 current active mounted partition .

I believe my /dev/sdb3 is having filesystem error that need to be fixed but it is actually current active raid partition.

May i know the simplest way to fsck the drive ? If possible without boot it using linux rescue disk ?

I found the following article :

http://wiki.sabayon.org/index.php?title=HOWTO:_Repair_filesystem_using_fsck_on_a_raid_setup

But in the article does not mentioned that i need to unmounted the /dev/md2 device first , afaik the fsck must be run on unmounted device to avoid data corruption.

FYI, the /dev/sdb3 is still active mounted as /dev/md2 .

Should i fsck /dev/sda3 or /dev/sdb3 ? and how ?


Appreciates anybody assistant on this.

Thank you.
0
Comment
Question by:smksa
7 Comments
 
LVL 47

Expert Comment

by:dlethe
ID: 38734569
You DON'T fsck a mounted device, at least not if you want to prevent data corruption.
  Boot the system to a USB stick with linux on it, then fsck.
0
 
LVL 2

Author Comment

by:smksa
ID: 38734574
Hi,

Do you mean the following articles is wrong ?

http://wiki.sabayon.org/index.php?title=HOWTO:_Repair_filesystem_using_fsck_on_a_raid_setup

It does not unmounted the /dev/md2 before fsck right ?
0
 
LVL 47

Accepted Solution

by:
dlethe earned 500 total points
ID: 38734602
Yes it is wrong.   Read this, it is derived from the kernel.org and the authors of the mdraid code itself ..

http://www.tldp.org/HOWTO/Software-RAID-0.4x-HOWTO-4.html
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 13

Expert Comment

by:Sandy
ID: 38735773
not recommended at all to run fsck with mounted partition.
0
 
LVL 19

Expert Comment

by:jools
ID: 38735927
What is it mounted as?

If it's prt of the operating system then you'll need to boot from other medi, if not then try unmounting it
0
 
LVL 2

Author Comment

by:smksa
ID: 38736831
Hi,

It is mounted as "/" .

So i guest eventhough it is a raid array, i still need to boot using other media and fsck it.
0
 
LVL 47

Expert Comment

by:dlethe
ID: 38736884
yes.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SonarQube on Linux vs Windows 3 52
AWS Central Authentication 1 87
Ubuntu Apache Webserver - File Permissions 5 59
how to print sub line with  sed /awk /perl in bash file 11 49
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question