Software RAID1 On A Running System (Ubuntu 10.10)

Discussion in 'HOWTO-Related Questions' started by kimlee, Jan 12, 2011.

  1. kimlee

    kimlee New Member

    Hello,

    I have two disks sda (contains the system) sdb (nothing), and i want to make a RAID1.
    I'd like to know if when i use fdisk on my sdB device, i also have to change the sda2 type into fd Linux raid autodetect?

    my disk repartition :

    sda1 /
    sda2 (extended partition)
    sda5 swap

    Thanks,
     
    Last edited: Jan 12, 2011
  2. falko

    falko Super Moderator Howtoforge Staff

  3. alex2323

    alex2323 New Member

    hi, I have 2 disks sda and sdb too, and sda disk does't have /boot partitiion, only /

    It is possible to create raid array without creating /boot partition?

    Thanks
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Yes, but you can't use LVM then.
     
  5. alex2323

    alex2323 New Member

    ok, my current server 10.04 running without LVM. And I can't use second tuturial.

    I just created
    /dev/md1 for /dev/sda1 (root) and
    /dev/md5 for /dev/sda5 (swap)

    I update files fstab, mtab... like in tuturial, but when I reboot server, server does't boot up. Line like "/dev/fd0 cannot mount" or some thing appeared.

    How can I apply second tutorial for my server? Thanks.
     
  6. falko

    falko Super Moderator Howtoforge Staff

  7. alex2323

    alex2323 New Member

    yes, I used this one
     
  8. alex2323

    alex2323 New Member

    here is my messages from ssh client before reboot:




    root@ubuntu:/# fdisk -l

    Disk /dev/sdb: 251.1 GB, 251059544064 bytes
    255 heads, 63 sectors/track, 30522 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000590a0

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 29778 239185920 fd Linux raid autodetect
    /dev/sdb2 29778 30523 5987329 5 Extended
    /dev/sdb5 29778 30523 5987328 fd Linux raid autodetect

    Disk /dev/sda: 251.1 GB, 251059544064 bytes
    255 heads, 63 sectors/track, 30522 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000a20ad

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 29778 239185920 83 Linux
    /dev/sda2 29778 30523 5987329 5 Extended
    /dev/sda5 29778 30523 5987328 82 Linux swap / Solaris

    Disk /dev/md1: 244.9 GB, 244926316544 bytes
    2 heads, 4 sectors/track, 59796464 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md1 doesn't contain a valid partition table

    Disk /dev/md5: 6130 MB, 6130958336 bytes
    2 heads, 4 sectors/track, 1496816 cylinders
    Units = cylinders of 8 * 512 = 4096 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/md5 doesn't contain a valid partition table







    root@ubuntu:/# mdadm -D /dev/md1
    /dev/md1:
    Version : 00.90
    Creation Time : Mon May 9 12:49:27 2011
    Raid Level : raid1
    Array Size : 239185856 (228.11 GiB 244.93 GB)
    Used Dev Size : 239185856 (228.11 GiB 244.93 GB)
    Raid Devices : 2
    Total Devices : 1
    Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Mon May 9 13:00:30 2011
    State : clean, degraded
    Active Devices : 1
    Working Devices : 1
    Failed Devices : 0
    Spare Devices : 0

    UUID : 63b56a30:4df0a2c6:e368bf24:bd0fce41 (local to host ubuntu)
    Events : 0.77

    Number Major Minor RaidDevice State
    0 0 0 0 removed
    1 8 17 1 active sync /dev/sdb1
    root@ubuntu:/#



    root@ubuntu:/# mdadm -D /dev/md5
    /dev/md5:
    Version : 00.90
    Creation Time : Mon May 9 12:49:39 2011
    Raid Level : raid1
    Array Size : 5987264 (5.71 GiB 6.13 GB)
    Used Dev Size : 5987264 (5.71 GiB 6.13 GB)
    Raid Devices : 2
    Total Devices : 1
    Preferred Minor : 5
    Persistence : Superblock is persistent

    Update Time : Mon May 9 12:50:51 2011
    State : clean, degraded
    Active Devices : 1
    Working Devices : 1
    Failed Devices : 0
    Spare Devices : 0

    UUID : f561fe59:059b51ea:e368bf24:bd0fce41 (local to host ubuntu)
    Events : 0.3

    Number Major Minor RaidDevice State
    0 0 0 0 removed
    1 8 21 1 active sync /dev/sdb5
    root@ubuntu:/#



    root@ubuntu:/# cat /proc/mdstat
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
    md5 : active raid1 sdb5[1]
    5987264 blocks [2/1] [_U]

    md1 : active raid1 sdb1[1]
    239185856 blocks [2/1] [_U]

    unused devices: <none>
    root@ubuntu:/#



    root@ubuntu:/# cat /etc/mdadm/mdadm.conf
    # mdadm.conf
    #
    # Please refer to mdadm.conf(5) for information about this file.
    #

    # by default, scan all partitions (/proc/partitions) for MD superblocks.
    # alternatively, specify devices to scan, using wildcards if desired.
    DEVICE partitions

    # auto-create devices with Debian standard permissions
    CREATE owner=root group=disk mode=0660 auto=yes

    # automatically tag new arrays as belonging to the local system
    HOMEHOST <system>

    # instruct the monitoring daemon where to send mail alerts
    MAILADDR root

    # definitions of existing MD arrays

    # This file was auto-generated on Mon, 09 May 2011 12:42:04 +0800
    # by mkconf $Id$
    ARRAY /dev/md1 level=raid1 num-devices=2 UUID=63b56a30:4df0a2c6:e368bf24:bd0fce41
    ARRAY /dev/md5 level=raid1 num-devices=2 UUID=f561fe59:059b51ea:e368bf24:bd0fce41
    root@ubuntu:/#



    root@ubuntu:/# mount
    /dev/md1 on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    none on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    none on /dev type devtmpfs (rw,mode=0755)
    none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    none on /dev/shm type tmpfs (rw,nosuid,nodev)
    none on /var/run type tmpfs (rw,nosuid,mode=0755)
    none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
    none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
    /dev/md1 on /mnt/md1 type ext4 (rw)



    root@ubuntu:/# cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid -o value -s UUID' to print the universally unique identifier
    # for a device; this may be used with UUID= as a more robust way to name
    # devices that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    proc /proc proc nodev,noexec,nosuid 0 0
    # / was on /dev/sda1 during installation
    #UUID=eb2d7178-e0a9-4a19-b6a2-117468b054be / ext4 errors=remount-ro 0 1
    /dev/md1 / ext4 errors=remount-ro 0 1
    # swap was on /dev/sda5 during installation
    #UUID=8a5751a9-f23f-4dfd-9a72-6a48eaa46999 none swap sw 0 0
    /dev/md5 none swap sw 0 0
    /dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
    root@ubuntu:/#



    root@ubuntu:/# cat /etc/mtab
    /dev/md1 / ext4 rw,errors=remount-ro 0 0
    proc /proc proc rw,noexec,nosuid,nodev 0 0
    none /sys sysfs rw,noexec,nosuid,nodev 0 0
    none /sys/fs/fuse/connections fusectl rw 0 0
    none /sys/kernel/debug debugfs rw 0 0
    none /sys/kernel/security securityfs rw 0 0
    none /dev devtmpfs rw,mode=0755 0 0
    none /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
    none /dev/shm tmpfs rw,nosuid,nodev 0 0
    none /var/run tmpfs rw,nosuid,mode=0755 0 0
    none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0
    none /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
    /dev/md1 /mnt/md1 ext4 rw 0 0




    root@ubuntu:/# cat /etc/grub.d/09_swraid1_setup
    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.
    menuentry 'Ubuntu, with Linux 2.6.32-21-server' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod raid
    insmod mdraid
    insmod ext2
    set root='(md1)'
    linux /boot/vmlinuz-2.6.32-21-generic-pae root=/dev/md1 ro quiet
    initrd /boot/initrd.img-2.6.32-21-generic-pae
    }
    root@ubuntu:/#



    root@ubuntu:/# cd /boot
    root@ubuntu:/boot# ls
    abi-2.6.32-21-generic-pae grub memtest86+.bin vmcoreinfo-2.6.32-21-generic-pae
    config-2.6.32-21-generic-pae initrd.img-2.6.32-21-generic-pae System.map-2.6.32-21-generic-pae vmlinuz-2.6.32-21-generic-pae
    root@ubuntu:/boot#



    root@ubuntu:/boot# uname -r
    2.6.32-21-generic-pae
     
  9. falko

    falko Super Moderator Howtoforge Staff

    /dev/sda5 has the wrong file system type! Must be Linux raid autodetect.
     
  10. alex2323

    alex2323 New Member

    hmm.. in your tutorial exist fdisk command for /dev/sdb, how /dev/sda can become autodetect before first reboot?
     
    Last edited: May 9, 2011

Share This Page