[Discuss] Please help with RAID1 on Ubuntu

Bill Horne bill at horne.net
Thu Jun 12 12:10:17 EDT 2014


Thanks for reading this.

As many of the BLU members know, I'm the editor of The Telecom Digest, 
which runs on a donated machine at a major university in Cambridge. 
Recently, the machine dropped a RAID disk, and is running in "degraded" 
status. Our benefactors have been kind, and have assigned us a new 
machine for the Digest: I am installing software RAID1 on it in 
preparation for adding LVM and copying the Telecom Digest archives over 
to it.

However - I have to do this by ssh. I've never installed any kind of 
RAID on a "live" machine, so I'm going /very/ carefully. If I brick the 
box, I'll have to ask for a reinstall.

As it stands now, I have the machine booted into an ext3 partition that 
will be used only for the RAID and LVM installs. Once I have the LVM up 
and running, I'm going to switch to booting from a separate /boot 
partition (I don't care if /boot is on RAID at this point: the clock is 
ticking on the "old" box, so I need a RAID1 array for the root first and 
foremost).

The machine came with a default Ubuntu 13.04 LTS install, which includes 
an LVM on /dev/sda, and a blank /dev/sdb. The plan is to create a 
degraded RAID1 array on the "spare" drive, and then copy the "live" 
drive data into it and subsequently join the two drives together in a 
RAID1 array, with LVM on top of RAID1.

However, we know what they say about the best laid plans ...

I've managed to create some sort of array, named "md127", but I haven't 
been able to figure out how. I did an "mdadm --create" with a name of 
"md1", but I've wound up with "md127". It appears to be working, albeit 
in degraded mode, but I want to go slowly and figure out what happened 
before I wind up with a non-standard install which might cause problems 
later.

Here's the output of my most recent ssh session (separators added for 
clarity):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mdadm -D /dev/md1
mdadm: cannot open /dev/md1: No such file or directory
telecomdigest5 at telecom-new:~$ sudo mdadm -D /dev/md127
/dev/md127:
         Version : 1.2
   Creation Time : Wed Jun 11 00:23:59 2014
      Raid Level : raid1
      Array Size : 716464832 (683.27 GiB 733.66 GB)
   Used Dev Size : 716464832 (683.27 GiB 733.66 GB)
    Raid Devices : 2
   Total Devices : 1
     Persistence : Superblock is persistent

     Update Time : Wed Jun 11 23:35:19 2014
           State : clean, degraded
  Active Devices : 1
Working Devices : 1
  Failed Devices : 0
   Spare Devices : 0

            Name : telecom-new:md1  (local to host telecom-new)
            UUID : c4e39dd8:541c124b:bd60a9b1:339d6e3e
          Events : 12

     Number   Major   Minor   RaidDevice State
        0       0        0        0      removed
        1       8       18        1      active sync   /dev/sdb2

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mdadm --examine /dev/sdb2
/dev/sdb2:
           Magic : a92b4efc
         Version : 1.2
     Feature Map : 0x0
      Array UUID : c4e39dd8:541c124b:bd60a9b1:339d6e3e
            Name : telecom-new:md1  (local to host telecom-new)
   Creation Time : Wed Jun 11 00:23:59 2014
      Raid Level : raid1
    Raid Devices : 2

  Avail Dev Size : 1432930035 (683.27 GiB 733.66 GB)
      Array Size : 716464832 (683.27 GiB 733.66 GB)
   Used Dev Size : 1432929664 (683.27 GiB 733.66 GB)
     Data Offset : 262144 sectors
    Super Offset : 8 sectors
           State : clean
     Device UUID : 45c648e7:60ae1ec9:c0623dc0:7b06a215

     Update Time : Wed Jun 11 23:35:19 2014
        Checksum : 6286503e - correct
          Events : 12


    Device Role : Active device 1
    Array State : .A ('A' == active, '.' == missing)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mkfs.ext4 /dev/md1
mke2fs 1.42.9 (4-Feb-2014)
Could not stat /dev/md1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mkfs.ext4 /dev/md127
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
44785664 inodes, 179116208 blocks
8955810 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
5467 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 
2654208,
         4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
         102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mkdir /mnt/raid1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:~$ sudo mount -text4 /dev/md127 /mnt/raid1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:/mnt/raid1$ sudo pico /mnt/raid1/test.txt

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - - - - - - -
telecomdigest5 at telecom-new:/mnt/raid1$ cat /mnt/raid1/test.txt
This is a test file, to check write permissions on the new RAID1 array.

(End of console output)

So, I am able to format the "md127" array, mount it, and write to it: of 
course, that's not the final state I'm aiming for, but for now I know 
that it is working with the "md127" name. I don't know how I wound up 
with the "md127" name instead of "md1", but if there's no danger sign in 
that name, I'm happy to go to the next step and make "md127" part of the 
LVM and proceed to add /dev/sda to the RAID1 array.

All advice, warnings, cautions, paranoia, and gotchas welcome. *PLEASE* 
keep in mind that I don't have access to the machine! Whatever I do, I 
have to be able to do via ssh: I'm able to reboot it, of course, but 
every time I do, I'm taking the chance of losing everything on it.

TIA.

Bill

-- 
Bill Horne
William Warren Consulting
339-364-8487




More information about the Discuss mailing list