# Raid does not longer accept a disk - what to do?

## Karsten1973

I run a gentoo server. On sda is /, on md0 all my data. md0 contains (or should contain) three disks, sdb,sdc and sdd. 

dmsg says:

```
 

[    0.811185] sd 3:0:0:0: [sdd] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[    0.811209] sd 2:0:0:0: [sdc] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[    0.811264] sd 1:0:0:0: [sdb] 3907029168 512-byte logical blocks: (2.00 TB/1.81 TiB)

[    0.811279] sd 3:0:0:0: [sdd] Write Protect is off

[    0.811281] sd 3:0:0:0: [sdd] Mode Sense: 00 3a 00 00

[    0.811310] sd 2:0:0:0: [sdc] Write Protect is off

[    0.811311] sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00

[    0.811336] sd 3:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.811394] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.811423] sd 1:0:0:0: [sdb] Write Protect is off

[    0.811424] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00

[    0.811442] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.812540] sd 0:0:0:0: [sda] Write Protect is off

[    0.812620] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

[    0.812630] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    0.818852]  sdd: sdd1

[    0.819309] sd 3:0:0:0: [sdd] Attached SCSI disk

[    0.820966]  sda: sda1 sda2 sda3

[    0.821413] sd 0:0:0:0: [sda] Attached SCSI disk

[    0.822006]  sdc: sdc1

[    0.822924] sd 2:0:0:0: [sdc] Attached SCSI disk

[    0.824001]  sdb: sdb1

[    0.824489] sd 1:0:0:0: [sdb] Attached SCSI disk

[    0.824615] md: Waiting for all devices to be available before autodetect

[    0.824699] md: If you don't use raid, use raid=noautodetect

[    0.824959] md: Autodetecting RAID arrays.

[    0.874787] md: invalid raid superblock magic on sdd1

[    0.874876] md: sdd1 does not have a valid v0.90 superblock, not importing!

[    0.905200] md: invalid raid superblock magic on sdc1

[    0.905283] md: sdc1 does not have a valid v0.90 superblock, not importing!

[    0.928185] md: invalid raid superblock magic on sdb1

[    0.928268] md: sdb1 does not have a valid v0.90 superblock, not importing!

[    0.928360] md: Scanned 3 and added 0 devices.

[    0.928438] md: autorun ...

[    0.928516] md: ... autorun DONE.

[    0.963192] kjournald starting.  Commit interval 5 seconds

[    0.963273] EXT3-fs (sda3): mounted filesystem with writeback data mode

[    0.963287] VFS: Mounted root (ext3 filesystem) readonly on device 8:3.

[    1.033571] devtmpfs: mounted

...

[    6.010801] md: bind<sdb1>

[    6.011898] md: bind<sdd1>

[    6.013712] md: bind<sdc1>

[    6.014546] md: kicking non-fresh sdd1 from array!

[    6.014553] md: unbind<sdd1>

[    6.019039] md: export_rdev(sdd1)

[    6.066809] md/raid:md0: device sdc1 operational as raid disk 1

[    6.066812] md/raid:md0: device sdb1 operational as raid disk 0

[    6.067111] md/raid:md0: allocated 0kB

[    6.067151] md/raid:md0: raid level 5 active with 2 out of 3 devices, algorithm 2

[    6.067154] RAID conf printout:

[    6.067155]  --- level:5 rd:3 wd:2

[    6.067157]  disk 0, o:1, dev:sdb1

[    6.067159]  disk 1, o:1, dev:sdc1

[    6.067190] md0: detected capacity change from 0 to 4000792182784

[    6.067577]  md0: unknown partition table

...

[   10.014444] UDF-fs: warning (device md0): udf_fill_super: No partition found (2)

[   10.015245] XFS (md0): Mounting V4 Filesystem

[   10.279085] XFS (md0): Ending clean mount

...

[  990.986112]  sdd: sdd1

[  991.085707]  sdd: sdd1

```

So something is wrong with sdd. Bios says SMART is active on sdd, and everything is okay. What should I do? I'm afraid of damaging something, so I would rather ask you guys first.

TIA!

 *Karsten1973 wrote:*   

> Crosspost from german-language, where I got no answers.

 

----------

## NeddySeagoon

Karsten1973,

Please post the output of 

```
mdadm -E /dev/sd[bcd]1
```

The smart info for /dev/sdd may be useful too.

----------

## szatox

Your sdd has some problem with data it contains. It doesn't mean drive itself is damaged.

Your log says it's raid5 made of 3 devices. So, I can think about 2 alternative things to do:

1) consider sdd a faild disk. Remove it from array, add it again and let it resynchronize.

2) reassemble array manualy. I found https://mknowles.com.au/wordpress/2013/05/01/reassembling-non-fresh-mdadm-raid-arrays/ at the very begining of google results on "kicking non-fresh from array". Without quotes ofcourse  :Smile:  At the first glance, looks promissing.

Both ways have their downsides. I would be more worried about result of (2) than (1), as you can't be sure the outcome. In case of (1) the only serious concern is a failure of another drive during repair process. Fortunately it's unlike to happen, and you can't really do much about it.

----------

## Karsten1973

 *NeddySeagoon wrote:*   

> Karsten1973,
> 
> Please post the output of 
> 
> ```
> ...

 

Thank you for your input!

 *Quote:*   

> mdadm -E /dev/sd[bcd]1
> 
> /dev/sdb1:
> 
>           Magic : a92b4efc
> ...

 

SMART INFO for sdd says:

 *Quote:*   

> smartctl -H /dev/sdd
> 
> smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.17.7-gentoo] (local build)
> 
> Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org
> ...

 

I'm not sure if that info helps... but here you go!

----------

## Karsten1973

 *szatox wrote:*   

> Your sdd has some problem with data it contains. It doesn't mean drive itself is damaged.
> 
> Your log says it's raid5 made of 3 devices. So, I can think about 2 alternative things to do:
> 
> 1) consider sdd a faild disk. Remove it from array, add it again and let it resynchronize.
> ...

 

I let you guys look at the output NeddySeagoon requested before I try any of that... just readding the disk with mdadm -add did not work, btw.

I'll add some more info I found:

```
cat /proc/mdstat

Personalities : [raid1] [raid10] [raid6] [raid5] [raid4]

md0 : active raid5 sdc1[1] sdb1[0]

      3907023616 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/2] [UU_]

unused devices: <none>

```

```
mdadm --misc --detail  /dev/md0

/dev/md0:

        Version : 1.2

  Creation Time : Thu Oct 21 00:41:52 2010

     Raid Level : raid5

     Array Size : 3907023616 (3726.03 GiB 4000.79 GB)

  Used Dev Size : 1953511808 (1863.01 GiB 2000.40 GB)

   Raid Devices : 3

  Total Devices : 2

    Persistence : Superblock is persistent

    Update Time : Wed Jan 14 18:21:00 2015

          State : clean, degraded

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

         Layout : left-symmetric

     Chunk Size : 64K

           Name : vanity:0  (local to host vanity)

           UUID : a970a1f6:7fb42fca:1ddc97ab:743c6870

         Events : 1191341

    Number   Major   Minor   RaidDevice State

       0       8       17        0      active sync   /dev/sdb1

       1       8       33        1      active sync   /dev/sdc1

       4       0        0        4      removed

```

Hm, "removed"? If removed, why can't I readd it?

```
mdadm --query /dev/sdd1

/dev/sdd1: is not an md array

/dev/sdd1: device 3 in 3 device mismatch raid5 /dev/md0.  Use mdadm --examine for more detail.

```

```
cat /etc/mdadm.conf

ARRAY /dev/md0 metadata=1.02 name=vanity:0 UUID=a970a1f6:7fb42fca:1ddc97ab:743c6870

```

----------

## Goverp

I've mentioned this before.  Autoassembly is deprecated.  It relies on V0.9 superblocks, and I guess some back-level code from an old version of mdadm copied into the kernel.  Your dmesg shows the kernel trying to automount using the 0.9 superblocks.  Then something else in your init is starting mdadm to assemble the array, and the mdadm output shows it's using V1.2 superblocks.  They're in different places.

I'll leave experts to help you recover your data. But I recommend that when that's sorted, you either reformat to use V0.9 superblocks (if you actually use deprecated autoassembly), or use an initramfs and explicit mdadm assembly, sticking to the V1.2 format.  I guess you aren't really using autoassembly normally, but your kernel is configured for it, and it's seeing the appropriate partition type, so it's trying.  Don't use both; the superblocks are in different places, so depending which format finally ends up being used risks overwriting the date from the other format.

----------

## Karsten1973

 *Goverp wrote:*   

> I've mentioned this before.  Autoassembly is deprecated.  It relies on V0.9 superblocks, and I guess some back-level code from an old version of mdadm copied into the kernel.  Your dmesg shows the kernel trying to automount using the 0.9 superblocks.  Then something else in your init is starting mdadm to assemble the array, and the mdadm output shows it's using V1.2 superblocks.  They're in different places.
> 
> I'll leave experts to help you recover your data. But I recommend that when that's sorted, you either reformat to use V0.9 superblocks (if you actually use deprecated autoassembly), or use an initramfs and explicit mdadm assembly, sticking to the V1.2 format.  I guess you aren't really using autoassembly normally, but your kernel is configured for it, and it's seeing the appropriate partition type, so it's trying.  Don't use both; the superblocks are in different places, so depending which format finally ends up being used risks overwriting the date from the other format.

 

Okay - I just reading up on that. My data seems secure at the moment, the raid is providing the data, its just read-only.

EDIT: Meanwhile I just added sdd1 to the raid, and that seems to have worked:

```
cat /proc/mdstat

Personalities : [raid1] [raid10] [raid6] [raid5] [raid4]

md0 : active raid5 sdd1[3] sdc1[1] sdb1[0]

      3907023616 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>

```

But for some reason my system will still mount md0 in read-only mode when booting. If I manually umount it, and the remount it like this

```
mount /dev/md0
```

(obviously using the fstab parameters I would assume being used during boot) I do mount it rw. 

So, besides the point of using autoassembly (on which help would be greatly appreciated) I now look for a way to mount md0 rw during boot...

```
cat /etc/fstab | grep md0

/dev/md0                /mnt/raid       auto            defaults        0 0

```

----------

## NeddySeagoon

Karsten1973,

The two drives sill working say,

```
     Update Time : Wed Jan 14 18:21:00 2015

          State : clean, degraded

...

          Events : 1191341 
```

The faulty one says, 

```
Update Time : Sat Jun 21 20:03:13 2014

Checksum : 4125e7e1 - correct

Events : 138 
```

so it fell out of the raid on : Sat Jun 21 20:03:13 2014, or 7 months ago.

You need to set up mdadm to email you about things like this.

You did not provide enough detail of the SMART output.  The summary statement passed, is often optimistic.

```
smartctl -a /dev/sdd
```

will be good - all of it.

As sdd1 is so old, you will need to fail it, remove it from the array then remove the raid metadata with mdadm before you can add it back.

mdadm will realise its part af a raid set and not let you add it back directly as its so old.

Its harmless to try this, even if the drive is faulty. 

Thats pretty much what szatox suggested.

As Goverp said, you can remove Raid Auto Assembly from your kernel.  You are not using it anyway and it will get rid of those errors in dmesg.

----------

## Karsten1973

Hi NeddySeagoon,

thanks for your input!

```
smartctl -a /dev/sdd

smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.17.7-gentoo] (local build)

Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===

Model Family:     SAMSUNG SpinPoint F3 EG

Device Model:     SAMSUNG HD203WI

Serial Number:    S2ACJDWZ800925

LU WWN Device Id: 5 0024e9 003e33227

Firmware Version: 1AN10003

User Capacity:    2.000.398.934.016 bytes [2,00 TB]

Sector Size:      512 bytes logical/physical

Rotation Rate:    5400 rpm

Form Factor:      3.5 inches

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   ATA8-ACS T13/1699-D revision 6

SATA Version is:  SATA 2.6, 3.0 Gb/s

Local Time is:    Mon Jan 19 16:04:05 2015 CET

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===

SMART overall-health self-assessment test result: PASSED

General SMART Values:

Offline data collection status:  (0x00)   Offline data collection activity

               was never started.

               Auto Offline Data Collection: Disabled.

Self-test execution status:      (   0)   The previous self-test routine completed

               without error or no self-test has ever 

               been run.

Total time to complete Offline 

data collection:       (25680) seconds.

Offline data collection

capabilities:           (0x5b) SMART execute Offline immediate.

               Auto Offline data collection on/off support.

               Suspend Offline collection upon new

               command.

               Offline surface scan supported.

               Self-test supported.

               No Conveyance Self-test supported.

               Selective Self-test supported.

SMART capabilities:            (0x0003)   Saves SMART data before entering

               power-saving mode.

               Supports SMART auto save timer.

Error logging capability:        (0x01)   Error logging supported.

               General Purpose Logging supported.

Short self-test routine 

recommended polling time:     (   2) minutes.

Extended self-test routine

recommended polling time:     ( 428) minutes.

SCT capabilities:           (0x003f)   SCT Status supported.

               SCT Error Recovery Control supported.

               SCT Feature Control supported.

               SCT Data Table supported.

SMART Attributes Data Structure revision number: 16

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate     0x002f   100   100   051    Pre-fail  Always       -       7729

  2 Throughput_Performance  0x0026   252   252   000    Old_age   Always       -       0

  3 Spin_Up_Time            0x0023   061   060   025    Pre-fail  Always       -       12023

  4 Start_Stop_Count        0x0032   098   098   000    Old_age   Always       -       2762

  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       19

  7 Seek_Error_Rate         0x002e   252   252   051    Old_age   Always       -       0

  8 Seek_Time_Performance   0x0024   252   252   015    Old_age   Offline      -       0

  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       8493

 10 Spin_Retry_Count        0x0032   252   252   051    Old_age   Always       -       0

 11 Calibration_Retry_Count 0x0032   252   252   000    Old_age   Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       103

191 G-Sense_Error_Rate      0x0022   028   028   000    Old_age   Always       -       733863

192 Power-Off_Retract_Count 0x0022   252   252   000    Old_age   Always       -       0

194 Temperature_Celsius     0x0002   056   051   000    Old_age   Always       -       44 (Min/Max 17/50)

195 Hardware_ECC_Recovered  0x003a   100   100   000    Old_age   Always       -       0

196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       19

197 Current_Pending_Sector  0x0032   252   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0030   252   252   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x0036   100   100   000    Old_age   Always       -       7

200 Multi_Zone_Error_Rate   0x002a   100   100   000    Old_age   Always       -       23561

223 Load_Retry_Count        0x0032   252   252   000    Old_age   Always       -       0

225 Load_Cycle_Count        0x0032   098   098   000    Old_age   Always       -       21372

SMART Error Log Version: 1

ATA Error Count: 7 (device log contains only the most recent five errors)

   CR = Command Register [HEX]

   FR = Features Register [HEX]

   SC = Sector Count Register [HEX]

   SN = Sector Number Register [HEX]

   CL = Cylinder Low Register [HEX]

   CH = Cylinder High Register [HEX]

   DH = Device/Head Register [HEX]

   DC = Device Command Register [HEX]

   ER = Error register [HEX]

   ST = Status register [HEX]

Powered_Up_Time is measured from power on, and printed as

DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,

SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 7 occurred at disk power-on lifetime: 8406 hours (350 days + 6 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:00:09.236  READ DMA

  ef 03 42 00 00 00 a0 00      00:00:09.236  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:00:09.236  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:00:09.236  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:00:09.232  NOP [Abort queued commands]

Error 6 occurred at disk power-on lifetime: 8405 hours (350 days + 5 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:14:06.673  READ DMA

  ef 03 42 00 00 00 a0 00      00:14:06.673  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:14:06.673  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:14:06.672  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:14:06.669  NOP [Abort queued commands]

Error 5 occurred at disk power-on lifetime: 8405 hours (350 days + 5 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:14:04.275  READ DMA

  ef 03 42 00 00 00 a0 00      00:14:04.275  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:14:04.275  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:14:04.275  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:14:04.272  NOP [Abort queued commands]

Error 4 occurred at disk power-on lifetime: 8400 hours (350 days + 0 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:00:09.366  READ DMA

  ef 03 42 00 00 00 a0 00      00:00:09.366  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:00:09.366  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:00:09.366  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:00:09.355  NOP [Abort queued commands]

Error 3 occurred at disk power-on lifetime: 454 hours (18 days + 22 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:01:56.240  READ DMA

  ef 03 42 00 00 00 a0 00      00:01:56.240  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:01:56.240  IDENTIFY DEVICE

  00 00 00 00 00 00 00 08      00:01:56.240  NOP [Abort queued commands]

  00 00 00 00 00 00 00 08      00:01:56.229  NOP [Abort queued commands]

SMART Self-test log structure revision number 1

No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 0

Note: revision number not 1 implies that no selective self-test has ever been run

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Completed [00% left] (0-65535)

    2        0        0  Not_testing

    3        0        0  Not_testing

    4        0        0  Not_testing

    5        0        0  Not_testing

Selective self-test flags (0x0):

  After scanning selected spans, do NOT read-scan remainder of disk.

If Selective self-test is pending on power-up, resume after 0 minute delay.

```

I removed autodetect from my kernel and added sdd to the raid. That seems to have worked, but raid is still mounted ro - I can umount it and remount it rw, but only after boot. I would like of course to boot into a writeable raid.

----------

## NeddySeagoon

Karsten1973,

Post your /etc/fstab and /proc/mdstat.

```
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE 

  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       19

196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       19

197 Current_Pending_Sector  0x0032   252   100   000    Old_age   Always       -       0 
```

Looks mostly harmless.  You have 19 reallocated sectors and none pending, so to the operating system, the drive will appear to be good.

You can run the long self test with smartctl and see if the test fails or the above elements change.  The long self test reads the entire drive surface, or stops at the first error.

To add sdd1 back to your raid, you need to use mdadm to fail /dev/sdd1, remove it from the raid set, destroy the raid metadata, then add it back to the raid.

It quite possible that  /dev/sdd1 was kicked out of the raid while it was remapping a faulty sector.

Resyncing the raid will write the entire /dev/sdd1 and may find more failing sectors. Check the above smart attributes after the resync to ensure that they are stable.

----------

## Karsten1973

```
cat /etc/fstab 

# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed; notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/sda1      /boot      ext2      noauto,noatime   1 2

/dev/sda3      /      ext3      noatime      0 1

/dev/sda2      none      swap      sw      0 0

#/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0

#/dev/fd0      /mnt/floppy   auto      noauto      0 0

/dev/md0      /mnt/raid   auto      defaults        0 0

/root/encfs_wrapper#/mnt/raid/backup-sync /mnt/raid/backup fuse defaults,kernel_cache 0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

#shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0

proc         /proc      proc      defaults      0 0

```

```
cat /proc/mdstat 

Personalities : [raid1] [raid10] [raid6] [raid5] [raid4] 

md0 : active raid5 sdd1[3] sdc1[1] sdb1[0]

      3907023616 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]

      

unused devices: <none>

```

I'll run the long smart test later, assuming that I have to unmount the disk for that...

----------

## NeddySeagoon

Karsten1973,

The drive runs the long test internally.   It will be slower if you use the raid but there is no need to give the test exclusive use of the drive.

```
3907023616 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU] 
```

looks good.

----------

## Karsten1973

Oh, I saw that a bit late.

Anyway, here is the result:

```

smartctl -l selftest /dev/sdd

smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.17.7-gentoo] (local build)

Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===

SMART Self-test log structure revision number 1

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Extended offline    Completed without error       00%      8518         -

```

Seems okay, right? I post the full result at the end of this post. 

But why does my raid only mount ro after boot???

```
smartctl -a /dev/sdd

smartctl 6.3 2014-07-26 r3976 [x86_64-linux-3.17.7-gentoo] (local build)

Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===

Model Family:     SAMSUNG SpinPoint F3 EG

Device Model:     SAMSUNG HD203WI

Serial Number:    S2ACJDWZ800925

LU WWN Device Id: 5 0024e9 003e33227

Firmware Version: 1AN10003

User Capacity:    2.000.398.934.016 bytes [2,00 TB]

Sector Size:      512 bytes logical/physical

Rotation Rate:    5400 rpm

Form Factor:      3.5 inches

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   ATA8-ACS T13/1699-D revision 6

SATA Version is:  SATA 2.6, 3.0 Gb/s

Local Time is:    Wed Jan 21 11:21:09 2015 CET

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===

SMART overall-health self-assessment test result: PASSED

General SMART Values:

Offline data collection status:  (0x00)   Offline data collection activity

               was never started.

               Auto Offline Data Collection: Disabled.

Self-test execution status:      (   0)   The previous self-test routine completed

               without error or no self-test has ever 

               been run.

Total time to complete Offline 

data collection:       (25680) seconds.

Offline data collection

capabilities:           (0x5b) SMART execute Offline immediate.

               Auto Offline data collection on/off support.

               Suspend Offline collection upon new

               command.

               Offline surface scan supported.

               Self-test supported.

               No Conveyance Self-test supported.

               Selective Self-test supported.

SMART capabilities:            (0x0003)   Saves SMART data before entering

               power-saving mode.

               Supports SMART auto save timer.

Error logging capability:        (0x01)   Error logging supported.

               General Purpose Logging supported.

Short self-test routine 

recommended polling time:     (   2) minutes.

Extended self-test routine

recommended polling time:     ( 428) minutes.

SCT capabilities:           (0x003f)   SCT Status supported.

               SCT Error Recovery Control supported.

               SCT Feature Control supported.

               SCT Data Table supported.

SMART Attributes Data Structure revision number: 16

Vendor Specific SMART Attributes with Thresholds:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  1 Raw_Read_Error_Rate     0x002f   100   100   051    Pre-fail  Always       -       7735

  2 Throughput_Performance  0x0026   055   055   000    Old_age   Always       -       23437

  3 Spin_Up_Time            0x0023   061   060   025    Pre-fail  Always       -       12023

  4 Start_Stop_Count        0x0032   098   098   000    Old_age   Always       -       2802

  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       19

  7 Seek_Error_Rate         0x002e   252   252   051    Old_age   Always       -       0

  8 Seek_Time_Performance   0x0024   252   252   015    Old_age   Offline      -       0

  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       8530

 10 Spin_Retry_Count        0x0032   252   252   051    Old_age   Always       -       0

 11 Calibration_Retry_Count 0x0032   252   252   000    Old_age   Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       103

191 G-Sense_Error_Rate      0x0022   028   028   000    Old_age   Always       -       733905

192 Power-Off_Retract_Count 0x0022   252   252   000    Old_age   Always       -       0

194 Temperature_Celsius     0x0002   061   051   000    Old_age   Always       -       39 (Min/Max 17/50)

195 Hardware_ECC_Recovered  0x003a   100   100   000    Old_age   Always       -       0

196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       19

197 Current_Pending_Sector  0x0032   252   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0030   252   252   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x0036   100   100   000    Old_age   Always       -       7

200 Multi_Zone_Error_Rate   0x002a   100   100   000    Old_age   Always       -       23562

223 Load_Retry_Count        0x0032   252   252   000    Old_age   Always       -       0

225 Load_Cycle_Count        0x0032   098   098   000    Old_age   Always       -       21557

SMART Error Log Version: 1

ATA Error Count: 7 (device log contains only the most recent five errors)

   CR = Command Register [HEX]

   FR = Features Register [HEX]

   SC = Sector Count Register [HEX]

   SN = Sector Number Register [HEX]

   CL = Cylinder Low Register [HEX]

   CH = Cylinder High Register [HEX]

   DH = Device/Head Register [HEX]

   DC = Device Command Register [HEX]

   ER = Error register [HEX]

   ST = Status register [HEX]

Powered_Up_Time is measured from power on, and printed as

DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,

SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 7 occurred at disk power-on lifetime: 8406 hours (350 days + 6 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:00:09.236  READ DMA

  ef 03 42 00 00 00 a0 00      00:00:09.236  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:00:09.236  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:00:09.236  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:00:09.232  NOP [Abort queued commands]

Error 6 occurred at disk power-on lifetime: 8405 hours (350 days + 5 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:14:06.673  READ DMA

  ef 03 42 00 00 00 a0 00      00:14:06.673  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:14:06.673  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:14:06.672  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:14:06.669  NOP [Abort queued commands]

Error 5 occurred at disk power-on lifetime: 8405 hours (350 days + 5 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:14:04.275  READ DMA

  ef 03 42 00 00 00 a0 00      00:14:04.275  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:14:04.275  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:14:04.275  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:14:04.272  NOP [Abort queued commands]

Error 4 occurred at disk power-on lifetime: 8400 hours (350 days + 0 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:00:09.366  READ DMA

  ef 03 42 00 00 00 a0 00      00:00:09.366  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:00:09.366  IDENTIFY DEVICE

  00 00 01 01 00 00 40 00      00:00:09.366  NOP [Abort queued commands]

  00 00 01 01 00 00 40 00      00:00:09.355  NOP [Abort queued commands]

Error 3 occurred at disk power-on lifetime: 454 hours (18 days + 22 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  84 51 01 00 00 00 e0  Error: ICRC, ABRT 1 sectors at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  c8 00 01 00 00 00 e0 00      00:01:56.240  READ DMA

  ef 03 42 00 00 00 a0 00      00:01:56.240  SET FEATURES [Set transfer mode]

  ec 00 00 00 00 00 a0 00      00:01:56.240  IDENTIFY DEVICE

  00 00 00 00 00 00 00 08      00:01:56.240  NOP [Abort queued commands]

  00 00 00 00 00 00 00 08      00:01:56.229  NOP [Abort queued commands]

SMART Self-test log structure revision number 1

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Extended offline    Completed without error       00%      8518         -

SMART Selective self-test log data structure revision number 0

Note: revision number not 1 implies that no selective self-test has ever been run

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Completed [00% left] (0-65535)

    2        0        0  Not_testing

    3        0        0  Not_testing

    4        0        0  Not_testing

    5        0        0  Not_testing

Selective self-test flags (0x0):

  After scanning selected spans, do NOT read-scan remainder of disk.

If Selective self-test is pending on power-up, resume after 0 minute delay.

```

----------

## Karsten1973

Still trying to figure out, why the raid is mounted ro after boot.

My /etc/fstab

```

/dev/sda1      /boot      ext2      noauto,noatime   1 2

/dev/sda3      /      ext3      noatime      0 1

/dev/sda2      none      swap      sw      0 0

#/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0

#/dev/fd0      /mnt/floppy   auto      noauto      0 0

/dev/md0      /mnt/raid   auto      defaults        0 0

/root/encfs_wrapper#/mnt/raid/backup-sync /mnt/raid/backup fuse defaults,kernel_cache 0 0

#shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0

proc         /proc      proc      defaults      0 0

```

After boot:

```
mount

/dev/sda3 on / type ext3 (rw,noatime,errors=continue,barrier=1,data=writeback)

devtmpfs on /dev type devtmpfs (rw,relatime,size=958752k,nr_inodes=239688,mode=755)

proc on /proc type proc (rw,relatime)

tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=192028k,mode=755)

mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)

cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)

cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)

freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)

/dev/md0 on /mnt/raid type xfs (ro,relatime,attr2,inode64,sunit=128,swidth=256,noquota)

rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)

nfsd on /proc/fs/nfsd type nfsd (rw,nosuid,nodev,noexec,relatime)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

encfs on /mnt/raid/backup type fuse.encfs (rw,relatime,user_id=0,group_id=0,default_permissions)

```

After simply umount and re-mounting md0 again:

```

/dev/sda3 on / type ext3 (rw,noatime,errors=continue,barrier=1,data=writeback)

devtmpfs on /dev type devtmpfs (rw,relatime,size=958752k,nr_inodes=239688,mode=755)

proc on /proc type proc (rw,relatime)

tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=192028k,mode=755)

mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)

fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)

openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)

cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)

cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)

freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)

rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)

nfsd on /proc/fs/nfsd type nfsd (rw,nosuid,nodev,noexec,relatime)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

/dev/md0 on /mnt/raid type xfs (rw,relatime,attr2,inode64,sunit=128,swidth=256,noquota)

```

----------

## NeddySeagoon

Karsten1973,

Wild guess ...

The filesystem is not cleanly unmounted at shutdown. Then it gets mouted ro as its 'dirty'.

Perform this test.

Reboot - verify /mnt/raid is read only.

Remount it rw but do not use it.

Give the sync command.

unmount /mnt/raid manually.

Reboot.

The above steps will tave performed a clean unmount prior to the reboot.

If /mnt/raid is rw after the rebbot, we neeh to look at the shutdown. 

If its still ro, the wild guess is wrong.

Are there any hints in dmesg when /mnt/raid comes up ro?

----------

## Karsten1973

Thank you for your patient help!

I shutdown all services using raid and commented the encryped filesystem on /mnt/raid/backup out of /etc/fstab, then did

```

umount /mnt/raid

mount /mnt/raid

sync

umount /mnt/raid

shutdown -r now

```

but it came up (after taking a very long time, almost giving me hope) ro again.

Here is dmesg:

```

dmesg | grep md0

[    6.073534] md/raid:md0: device sdb1 operational as raid disk 0

[    6.073537] md/raid:md0: device sdc1 operational as raid disk 1

[    6.073539] md/raid:md0: device sdd1 operational as raid disk 2

[    6.073834] md/raid:md0: allocated 0kB

[    6.073887] md/raid:md0: raid level 5 active with 3 out of 3 devices, algorithm 2

[    6.073932] md0: detected capacity change from 0 to 4000792182784

[    6.074265]  md0: unknown partition table

[  266.669589] UDF-fs: warning (device md0): udf_fill_super: No partition found (2)

[  266.670286] XFS (md0): Mounting V4 Filesystem

[  269.233440] XFS (md0): Ending clean mount

```

Since we assumed that the unknown partition table was caused by kernel autodetection:

```

cat /usr/src/linux/.config | grep AUTODETECT

# CONFIG_MD_AUTODETECT is not set

```

Maybe its the partition table after all?

----------

## NeddySeagoon

Karsten1973,

```
[    6.073534] md/raid:md0: device sdb1 operational as raid disk 0

[    6.073537] md/raid:md0: device sdc1 operational as raid disk 1

[    6.073539] md/raid:md0: device sdd1 operational as raid disk 2

[    6.073834] md/raid:md0: allocated 0kB

[    6.073887] md/raid:md0: raid level 5 active with 3 out of 3 devices, algorithm 2

[    6.073932] md0: detected capacity change from 0 to 4000792182784

[    6.074265]  md0: unknown partition table 
```

is all quite normal.

raid sets do not need to be partitioned and until recenty, you could create partitions on raid sets but the kernel wou/d not see them, so they could not be used.

Your fstab entry may be significant.

```
/dev/md0      /mnt/raid   auto      defaults        0 0 
```

auto is a bad choice for filesystem type almost anywhere.  You are asking mount to guess the filesystem.

It does this by trying them all in turn. You can see the error when it tries UDF.  

```
[  266.669589] UDF-fs: warning (device md0): udf_fill_super: No partition found (2)

[  266.670286] XFS (md0): Mounting V4 Filesystem

[  269.233440] XFS (md0): Ending clean mount 
```

Eventually it gets to xfs.  Try xfs in place of auto in your fstab.

Auto can be used on optical media, where they are read only anyway and may use UDF or iso9660.

When mount makes a wrong guess and mounts the fs rw, it makes an ugly mess.

-- edit2 -- Changed Try kfs to Try xfs

----------

## Karsten1973

I will try that and report - but am away atm, so it might take me a while.

----------

