LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-27-2015, 09:29 PM   #1
QYInst
LQ Newbie
 
Registered: Jan 2015
Posts: 17

Rep: Reputation: Disabled
Distributed RAID(5/6) over NBD, fail to assemble after rebooting


Hi all,
I am trying to build a distributed RAID (5 or 6) with several linux servers in a LAN environment.
The goal is to make use of all the hard disks of all the serves, for safely I/O and data storage.
We do not care much about the I/O speed, since there are not many users (no frequently write/read), and only 3-5 machines.
In this case, I think RAID 5 or 6 are good enough, while RAID 1/10 waste too much storage.

On the other hand, in order to share local hard disks (block devices) with remote computers, and create RAID over networking, I decide to use RAID over NBD. Since it is simple and free.

I have done some tests using two ubuntu-14.10 desktops (let us say host0 and host1) so far. The softwares I used are:
Quote:
mdadm -- v3.3
nbd-server/client -- v3.8
host1 shares 4 block devices through LAN (/dev/sda{5,6,7,8}) using nbd-server, which are connected as nbd{0,1,2,3} at host0.
Then the RAID 5 system is created at host0 together with the local /dev/sda{5,6,7}:
Code:
# mdadm --create --auto=yes /dev/md0 --level=5 --raid-devices=5 --spare-devices=2 /dev/sda{5,6,7} /dev/nbd{0,1,2,3}
# mkfs.ext4 /dev/md0
# mount /dev/md0 /mnt/md
Up to now everything goes smoothly, it works very well.

However, since the electric power here is not very reliable, I tried rebooting host1, to see if the RAID can be recovered correctly.
After host1 starts, of course the file system mounted at host0:/mnt/md is now read-only. Then I umounted the RAID and checked the details:
Code:
# umount /mnt/md
# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Wed Jan 28 09:48:10 2015
     Raid Level : raid5
     Array Size : 195172352 (186.13 GiB 199.86 GB)
  Used Dev Size : 48793088 (46.53 GiB 49.96 GB)
   Raid Devices : 5
  Total Devices : 7
    Persistence : Superblock is persistent

    Update Time : Wed Jan 28 11:11:53 2015
          State : clean, FAILED 
 Active Devices : 3
Working Devices : 3
 Failed Devices : 4
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

           Name : host0:0  (local to host host0)
           UUID : fa43d095:47309bb4:4beaccca:fde903a4
         Events : 23

    Number   Major   Minor   RaidDevice State
       0       8        5        0      active sync   /dev/sda5
       1       8        6        1      active sync   /dev/sda6
       2       8        7        2      active sync   /dev/sda7
       6       0        0        6      removed
       8       0        0        8      removed

       3      43        0        -      faulty   /dev/nbd0
       5      43       32        -      faulty   /dev/nbd2
       6      43       48        -      faulty   /dev/nbd3
       7      43       16        -      faulty   /dev/nbd1

$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid5 nbd1[7](F) nbd3[6](F) nbd2[5](F) nbd0[3](F) sda7[2] sda6[1] sda5[0]
      195172352 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/3] [UUU__]
      
unused devices: <none>
These are what we may expected. In this case, I tried to assemble the RAID:
Code:
# mdadm --stop /dev/md0
# mdadm --assemble --force /dev/md0 /dev/sda{5,6,7} /dev/nbd{0,1,2,3}
mdadm: clearing FAULTY flag for device 5 in /dev/md0 for /dev/nbd2
mdadm: clearing FAULTY flag for device 6 in /dev/md0 for /dev/nbd3
mdadm: Marking array /dev/md0 as 'clean'
mdadm: /dev/md0 assembled from 3 drives and 2 spares - not enough to start the array.

$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : inactive sda5[0](S) nbd3[6](S) nbd2[5](S) nbd1[7](S) nbd0[3](S) sda7[2](S) sda6[1](S)
      341563993 blocks super 1.2
       
unused devices: <none>

# mdadm --examine /dev/sda{5,6,7} /dev/nbd{0,1,2,3}
   *** All the states are 'clean' ***
   Array State : AAA..
   Array State : AAA..
   Array State : AAA..
   Array State : AAAAA
   Array State : AAAAA
   Array State : AAAAA
   Array State : AAAAA
Absolutely I failed to re-assemble the RAID. And mdadm --manage does not work at all.

However, I find re-creating the RAID works:
Code:
# mdadm --create --auto=yes /dev/md0 --level=5 --raid-devices=5 --spare-devices=2 /dev/sda{5,6,7} /dev/nbd{0,1,2,3}
I have check and all the data is there.

Sorry for the boring details. Here comes my questions:
1. Is re-creating the RAID always safe?
2. How can I re-assemble (or recover) the RAID after rebooting of one node? I did not write anything to the devices, and in principle all the data should be there, right?

BTW, RAID 6 is a solution for this case, which can rebuild 2 failed disks. However, it does not solve my problem, since all the nodes may shutdown at the same time due to tripping of the eclectric power.

Thank you very much for any comments and suggestions!
 
Old 01-28-2015, 08:49 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
You are tap-dancing on a landmine. Since ext filesystems don't have data integrity checking, you don't know whether "all the data is there". fsck only tells you the filesystem metadata is intact.

Any write going on at the time you disconnect multiple drives from a RAID 5 or 6 will leave the array corrupted and that stripe of data unrecoverable. If you care about your data put all the drives in a single enclosure and power that server and the drives with a UPS.
 
Old 01-28-2015, 07:02 PM   #3
QYInst
LQ Newbie
 
Registered: Jan 2015
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
You are tap-dancing on a landmine. Since ext filesystems don't have data integrity checking, you don't know whether "all the data is there". fsck only tells you the filesystem metadata is intact.
Thanks. I have checked not only fsck for the filesystem. Actually I have copied a bunch of data for testing in advance, and after re-creating the RAID all the data is there.
I know I am taking risks with such operation. However, I cannot come up with a workaround. Maybe I have to give up on this idea of building RAID over NBD. This is what tests for, i.e. exploring problems in advance. ;-)

Quote:
Originally Posted by smallpond View Post
Any write going on at the time you disconnect multiple drives from a RAID 5 or 6 will leave the array corrupted and that stripe of data unrecoverable. If you care about your data put all the drives in a single enclosure and power that server and the drives with a UPS.
Yes, you are right. I am still wondering if there is any safely workaround, for making use of the hard disks from different machines. Maybe I am just too naive.;-)
 
Old 01-28-2015, 07:59 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Look at a real world cluster filesystem, e.g. Ceph, Gluster, Lustre, probably others, that is actually designed for this sort of thing with the necessary redundancy and recovery protocols. Trying to run multiple-machine RAID just does not seem like a good idea to me.
 
1 members found this post helpful.
Old 01-28-2015, 08:45 PM   #5
QYInst
LQ Newbie
 
Registered: Jan 2015
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by btmiller View Post
Look at a real world cluster filesystem, e.g. Ceph, Gluster, Lustre, probably others, that is actually designed for this sort of thing with the necessary redundancy and recovery protocols. Trying to run multiple-machine RAID just does not seem like a good idea to me.
Sounds great. I think those are what I have been looking for.
I will take a look at the filesystems. Thanks a lot!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-assemble RAID 5 array scottastanley Linux - Server 9 01-07-2013 11:44 PM
[SOLVED] mdadm RAID 5 assemble sag47 Linux - Software 1 12-17-2011 06:13 PM
RAID 10 won't assemble Bubbagump210 Linux - Server 1 12-08-2010 12:03 PM
How do I get mdadm to assemble a raid using local and nbd devices adrian_stephens Linux - Server 3 05-29-2009 10:42 AM
Cannot assemble my clean RAID... silicon.pyro Linux - Server 12 08-20-2007 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration