Pages

Friday 30 November 2012

MDADM: start raid1 array with one device

When I was home, I copied a lot of pictures to a raid array. As I moved back, I brought only one disk with me. Now, I would like to access the data on that drive, in a read-only fashion.
sudo mdadm --assemble /dev/md0 /dev/sdb1
This printed out the following:
mdadm: /dev/md0 assembled from 1 drive - need all 2 to start it (use --run to insist).
Let's see the status:
cat /proc/mdstat
Gives me:
md0 : inactive sdb1[1](S)
      625129216 blocks
Okay, so this array definitely needs activation. I decided to run this array:
sudo mdadm --run /dev/md0
And now, let's see the status:
cat /proc/mdstat
It seems, that the device is now active.
md0 : active raid1 sdb1[1]
      625129216 blocks [2/1] [_U]
I expected to see a read only mode, and it is a bit annoying, that it seems that it is not r/o. Now, I try to set it to read-only:
sudo mdadm --readonly /dev/md0
And now, it seems better:
cat /proc/mdstat
shows:
md0 : active (read-only) raid1 sdb1[1]
      625129216 blocks [2/1] [_U]
And now, it is time to mount it!
sudo mount --read-only /dev/md0 /mnt/p1
The good stuff, is that I managed to mount it, and hopefully, as I put it back to its original place, it will still be fine.
sudo mdadm --detail /dev/md0
See the "Update Time" (which is exactly the date, when I last accessed the array)
/dev/md0:
        Version : 0.90
  Creation Time : Wed Nov 21 22:52:49 2012
     Raid Level : raid1
     Array Size : 625129216 (596.17 GiB 640.13 GB)
  Used Dev Size : 625129216 (596.17 GiB 640.13 GB)
   Raid Devices : 2
  Total Devices : 1
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Thu Nov 22 07:10:02 2012
          State : clean, degraded 
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           UUID : 9d82c2e5:33bd53b5:e4d1075c:94619d7b
         Events : 0.40

    Number   Major   Minor   RaidDevice State
       0       0        0        0      removed
       1       8       17        1      active sync   /dev/sdb1

No comments:

Post a Comment