Posted by: isaraffee | August 1, 2009

Exploring RAID in OpenSUSE 11.1 Part 2

Mounting the RAID Device.

neptune:~ # mount /dev/md0 /mnt/

Check that the RAID device is mounted.

neptune:~ # mount

/dev/sda6 on / type ext3 (rw,acl,user_xattr)

/proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

debugfs on /sys/kernel/debug type debugfs (rw)

udev on /dev type tmpfs (rw)

devpts on /dev/pts type devpts (rw,mode=0620,gid=5)

/dev/sda7 on /home type ext3 (rw,acl,user_xattr)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

securityfs on /sys/kernel/security type securityfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)

/dev/md0 on /mnt type ext3 (rw)

Explore the /mnt directory

neptune:~ # cd /mnt

neptune:/mnt # ll

total 16

drwx—— 2 root root 16384 Apr 14 11:28 lost+found

neptune:/mnt # echo “Howdy, RAID ;)” > /mnt/test.txt

neptune:/mnt # cat /mnt/test.txt

Howdy, RAID πŸ˜‰

Update the /etc/mdadm.conf so that your RAID is started automatically with the rest of your filesystems at boot time.

But first let us see the initial configuration of this file.

neptune:/mnt # more /etc/mdadm.conf

DEVICE partitions

ARRAY /dev/md0 level=raid1 UUID=29452c4e:71deeb27:d2c12575:8954d9e1

Now let’s configure this file.

neptune:/mnt # mdadm –detail –scan | tee -a /etc/mdadm.conf

ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90 UUID=29452c4e:71deeb27:d2c12575:8954d9e1

Verifying that the data is in fact being mirrored. Stop and unmount the RAID, and mount (read-only) each of the component partitions and see that the same data is in place.

neptune:~ # cd /

neptune:/ # mdadm –stop /dev/md0

mdadm: failed to stop array /dev/md0: Device or resource busy

Perhaps a running process, mounted filesystem or active volume group?

Here I am unable to stop the RAID because it is mounted. So let’s unmount the RAID first.

neptune:~ # umount /dev/md0

Now, stop the RAID.

neptune:~ # mdadm –stop /dev/md0

mdadm: stopped /dev/md0

Next mount one of the RAID member device, in my case it’s /dev/sda2

neptune:~ # mount -o ro -t ext3 /dev/sda2 /mnt

Check that the file that we created earlier is still there

neptune:~ # cd /mnt

neptune:/mnt # ls

lost+found test.txt

neptune:/mnt # cat test.txt

Howdy, RAID πŸ˜‰

Yes, the contents of the file are still there.

Do the same for the other RAID member device, and in my case it’s /dev/sda3

neptune:~ # cd

neptune:~ # umount /mnt

neptune:~ # mount -o ro -t ext3 /dev/sda3 /mnt

neptune:~ # ls /mnt

lost+found test.txt

neptune:~ # cat /mnt/test.txt

Howdy, RAID πŸ˜‰

Yes the other RAID member device also has the same file contents.

To restart and remount the RAID

Firstly, unmount the /mnt directory

neptune:~ # umount /mnt

Then restart RAID by typing:

neptune:~ # mdadm –assemble /dev/md0

mdadm: /dev/md/0 has been started with 2 drives.

Mount the RAID devices

neptune:~ # mount /dev/md0 /mnt

Check that the RAID device is mounted

neptune:~ # mount

/dev/sda6 on / type ext3 (rw,acl,user_xattr)

/proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

debugfs on /sys/kernel/debug type debugfs (rw)

udev on /dev type tmpfs (rw)

devpts on /dev/pts type devpts (rw,mode=0620,gid=5)

/dev/sda7 on /home type ext3 (rw,acl,user_xattr)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

securityfs on /sys/kernel/security type securityfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)

/dev/md0 on /mnt type ext3 (rw)

Alternatively, you can also type:

neptune:~ # df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda6 7.7G 3.1G 4.3G 43% /

udev 247M 196K 247M 1% /dev

/dev/sda7 12G 161M 11G 2% /home

/dev/md0 4.0G 73M 3.7G 2% /mnt

We see that the RAID device /dev/md0 is mounted on /mnt

If you look closely, the size of the RAID is 4GB I.e half of the size of the total capacity of the partitions. You see at the beginning we configured two partitions of size 4 GB each, which equals 8 GB in total. But after configured these 2 partitons with RAID 1 (mirroring) the capacity is half I.e 4 GB. This explains why we only have 4GB of space and not 8 GB.

What Happens to RAID After Reboot?

The RAID partitions are not mounted automatically after reboot.

neptune:~ # mount

/dev/sda6 on / type ext3 (rw,acl,user_xattr)

/proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

debugfs on /sys/kernel/debug type debugfs (rw)

udev on /dev type tmpfs (rw)

devpts on /dev/pts type devpts (rw,mode=0620,gid=5)

/dev/sda7 on /home type ext3 (rw,acl,user_xattr)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

securityfs on /sys/kernel/security type securityfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

The fdisk copmmand however shows the RAID partitions and you have to manually mount it. Before that , type the following command to see the RAID details.

neptune:~ # mdadm /dev/md0

/dev/md0: 3.100GiB raid1 2 devices, 0 spares. Use mdadm –detail for more detail.

A much better command is to use the argument –detail to the command.

neptune:~ # mdadm –detail /dev/md0

/dev/md0:

Version : 0.90

Creation Time : Tue Apr 14 09:49:06 2009

Raid Level : raid1

Array Size : 4192896 (4.00 GiB 4.29 GB)

Used Dev Size : 4192896 (4.00 GiB 4.29 GB)

Raid Devices : 2

Total Devices : 2

Preferred Minor : 0

Persistence : Superblock is persistent

Update Time : Wed Apr 22 12:31:31 2009

State : clean

Active Devices : 2

Working Devices : 2

Failed Devices : 0

Spare Devices : 0

UUID : 29452c4e:71deeb27:d2c12575:8954d9e1

Events : 0.8

Number Major Minor RaidDevice State

0 8 2 0 active sync /dev/sda2

1 8 3 1 active sync /dev/sda3

Let’s mount the RAID

neptune:~ # mount /dev/md0 /mnt

And check the available disk free space.

neptune:~ # df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda6 7.7G 3.1G 4.3G 43% /

udev 247M 204K 247M 1% /dev

/dev/sda7 12G 169M 11G 2% /home

/dev/md0 4.0G 73M 3.7G 2% /mnt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: