LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Synology NAS and RAID concepts (https://www.linuxquestions.org/questions/linux-hardware-18/synology-nas-and-raid-concepts-801698/)

depam 04-13-2010 03:15 AM

Synology NAS and RAID concepts
 
Hi,

I just bought a NAS drive which occupies 4 bay hard drive. Inside currently are two 1.5 TB hard drives and I have configured it as a RAID1. Please note that this is also using a Linux OS but I don't know what kind of distribution. I am really amazed on what this product can do and how it treats the RAID and can accept different sizes of disks as long as it is the capacity is higher than the smallest disk.

I have read all the RAID concepts but I have not truly played with it in real life. So I wanted to ask if anyone have experience on this.

Here are the test cases that I want to ask:

1.) If I break the mirror and allow the single disk to run and alter any data into it, can I recover everything from the hard disk that I have pulled?
2.) If I break the mirror and put it back right away, how long it is to re-sync?

I would like to know so I know how to use the capability. Thanks.

deadeyes 04-13-2010 10:19 AM

Quote:

1.) If I break the mirror and allow the single disk to run and alter any data into it, can I recover everything from the hard disk that I have pulled?
Although it might not be straight forward it should be possible. You should let the config on the disk to be read and make sure you do not write a new config on the disk and if it is hardware raid also not on the raid controller(normally it asks what config you want to use: config on disk or config on controller).
I do wonder what the use would be for this use case.

Quote:

2.) If I break the mirror and put it back right away, how long it is to re-sync?
I don't think anyone would be able to give you a sensible answer to this. It depends on alot of things. You have to think that everything should be copied to the other disk again.
So you might have some degrade performance.

depam 04-13-2010 10:41 AM

Hi deadeyes,

Thanks for the reply.

1.) The reason for me to do this is that I want to have a cold copy while I do something on the data on the other disks. If I mess up something then I want to remirror back using the cold copy. I am not sure whether commercial NAS is software/hardware RAID. I do believe it is software raise cause I can see both disks when I view /proc/mdstat:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
1460417308 blocks super 1.1 [2/2] [UU]

md1 : active raid1 sda2[0] sdb2[1]
2097088 blocks [4/2] [UU__]

md0 : active raid1 sda1[0] sdb1[1]
2490176 blocks [4/2] [UU__]

unused devices: <none>
DS410-NAS1>

I just don't know how to do this remirroring back in real life using this NAS. That is why I am also hesitant to do. Have you done this before? In other servers I think it will be possible but not on this stand alone NAS.

2.) Yes you are correct. This NAS took almost half day to complete resync on 1.5 TB.

deadeyes 04-14-2010 04:40 AM

I can only say that you should try it on your NAS and see what it gives.

Your output shows it is software raid.

Alot of people make the mistake thinking that RAID = backup.
RAID is NOT backup. It is just redundancy. So I would suggest you make good backups.

You made me curious about this :)
If I find the time I will test this. Probably it will be possible with mdadm -A /dev/md0 /dev/sdc1
This is a device file md0 assembled from /dev/sdc1 (which should be a partition of type: fd)

depam 04-14-2010 06:59 AM

Hi deadeyes,

Thanks a lot.

I didn't know software RAID can also handle more complex RAID configurations. Can you please let me know what mdadm -A /dev/md0 /dev/sdc1 will do? Yes I understand that RAID is not backup but redundancy. I just want to have the knowledge just in case I need it in the future. Because in our environment, we usually break the mirror of RAID 1 everytime we do patching. But I never had ask the engineers how to rebuild it back using the cold backup disks when something goes wrong. But I do think there is a way to do it. If you have tried this, please let me know. Cheers.

alli_yas 04-14-2010 09:26 AM

Hi depam,

I currently administer multiple commercial grade EMC NAS devices in my environment - my advice to you is that you should rather do a proper backup of your data; than relying on breaking a mirror and using this as a cold backup.

The point of having a RAID 1 mirror is that it will allow you two things:

1. Cater for failure of 2 disks
2. Allow double the read speed due to double the disks.

If you have the machines/disks available, an option is for you to add in another 2 disks to your NAS; and expose these to a separate machine. Therafter you could use something like rsync to do a synchronize between the two boxes at regular intervals (my EMC kit has some built in NAS Replication software that does this for me); which will allow for you to safely patch your machine.

Hope this helps :D

deadeyes 04-14-2010 09:52 AM

I tried it :D

Created three partitions:
/dev/sda6 636 648 104391 fd Linux raid autodetect
/dev/sda7 649 661 104391 fd Linux raid autodetect
/dev/sda8 662 674 104391 fd Linux raid autodetect

2 of them I have put in a raid1:
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda6 /dev/sda7

Created fs:
mkfs.ext3 /dev/md1

Mounted:
mount /dev/md1 /mnt

Created a file:
touch /mnt/file1

Removed one disk from raid array:
mdadm /dev/md1 -f /dev/sda7
mdadm /dev/md1 -r /dev/sda7

Created a new file:
touch /mnt/file2

Unmounting fs:
umount /mnt

Removing the second "disk" (which has actually 2 files on the filesystem):
mdadm /dev/md0 -f /dev/sda6
mdadm /dev/md0 -r /dev/sda6
If this does not work use:
mdadm --stop /dev/md0

Assembling the disk again with the /dev/sda7 (which had been removed first and has only 1 file):
mdadm --assemble /dev/md0 /dev/sda7
I got this message: mdadm: /dev/md0 assembled from 1 drive - need all 2 to start it (use --run to insist).
mdadm --run /dev/md0

Now I can mount /dev/md0 again and only one file is there: file1.
This shows what you where wondering about :)

Lets add the first again:
mdadm /dev/md0 -a /dev/sda6

When looking in the mounted fs on /mnt:
file1

This should save your config to a file:
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf

Do note that you there might be some specifics to your NAS.

Hi five ;) :D

deadeyes 04-14-2010 09:57 AM

Quote:

Originally Posted by alli_yas (Post 3935335)
Hi depam,

I currently administer multiple commercial grade EMC NAS devices in my environment - my advice to you is that you should rather do a proper backup of your data; than relying on breaking a mirror and using this as a cold backup.

The point of having a RAID 1 mirror is that it will allow you two things:

1. Cater for failure of 2 disks
2. Allow double the read speed due to double the disks.

If you have the machines/disks available, an option is for you to add in another 2 disks to your NAS; and expose these to a separate machine. Therafter you could use something like rsync to do a synchronize between the two boxes at regular intervals (my EMC kit has some built in NAS Replication software that does this for me); which will allow for you to safely patch your machine.

Hope this helps :D

1. Errrr... RAID1 with 2 disks will not protect against 2 disk failures. Use raid6 then.
2. RAID1 is mirroring. I would expect a bigger performance using raid0. Unless there is some good programming logic that uses 2 disks seperately to read data(I don't know if that is the case.).

depam 04-14-2010 10:47 AM

Hi deadeyes,

Thanks a lot for doing this. You are so good to try it out for me. Now, I need to find if my NAS can do it. I have contacted the vendor and asked them what is the initial behavior when I do this cause there might be some configurations they have done that may differ from your test case. I really appreciate your effort. You are a big help to people like me wondering about the possibilities. Cheers :)

deadeyes 04-15-2010 02:56 AM

This output shows it is linux software raid (md):
Code:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
1460417308 blocks super 1.1 [2/2] [UU]

md1 : active raid1 sda2[0] sdb2[1]
2097088 blocks [4/2] [UU__]

md0 : active raid1 sda1[0] sdb1[1]
2490176 blocks [4/2] [UU__]

unused devices: <none>
DS410-NAS1>

mdadm --detail gives such output if I am correct.
So as long as you are restoring to the same device it should be ok.
But indeed it could be that they are doing something strange.
I strongly advice you to test this out on your machine. Don't count on it working unless you have tested it and it does work.

depam 04-18-2010 05:54 AM

Hi deadeyes,

Thanks for the info. I have created the backup of my data as usual and have tried it on the NAS. I didn't do this on the command line since the NAS have GUI to do this and also I want to test if it is the same result. Here is the result so far in RAID1:

1.) Shutdown NAS (NAS is not how-swap)
2.) Pull out the second drive HDD2. Removed one file from the HDD1. I was surprised because the vendor told me that if you remove one disk or it gets broken, the volume will be in read only. But I was still able to remove one file.
3.) Power up the NAS and I can see that the volume is degraded --> This is expected as I removed the secondary drive.
4.) I powered down the NAS and this time I remove HDD1 and put the HDD2 in the first slot. After powering on, volume is still degraded but I can still see my data including the file I removed from HDD1 so I think this is okay. It proved to me that I can just put back another hard drive or even the HDD1 to resync. So I have conclude my test case that it should behave the same as your test case.
5.) After putting back all the drive, now I have problem. I am getting error "System Partition Failed" on HDD2. I have tried to swap it on the slot and it still have the error. I cannot do resync or repair. I went to the vendor asked them to remove all partition and this solved the problem and successfully resync.

I am just curious whether during resync on RAID1, is it supposed to erase the drive from the second harddisk you inserted and overwrite by anything that is on the other drive? I am confused whether it can recognize the drive that was previously inserted and will continue the syncing as where it is left?

Now, I am converting the RAID1 to RAID5. I bought additional 2 drives 1.5TB and wants to include this in the array and convert it to RAID5. Luckily, it was able to detect the disks on all four but it is taking time to reshape and expand the array. Its already 1 days and 9 hours but is still waiting to finish. I assume that whenever power interruption occur, the array will sure have problem.

DS410-NAS1> cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid5 sdd3[4] sdc3[3] sda3[2] sdb3[0]
1460417280 blocks super 1.1 level 5, 64k chunk, algorithm 2 [4/4] [UUUU]
[===========>.........] reshape = 58.4% (853324280/1460417280) finish=1514.9min speed=6677K/sec

md1 : active raid1 sdd2[3] sdc2[2] sda2[0] sdb2[1]
2097088 blocks [4/4] [UUUU]

md0 : active raid1 sdd1[3] sdc1[2] sda1[0] sdb1[1]
2490176 blocks [4/4] [UUUU]

unused devices: <none>
DS410-NAS1>


DS410-NAS1> mdadm --detail /dev/md2
/dev/md2:
Version : 1.01
Creation Time : Sat Apr 17 08:49:23 2010
Raid Level : raid5
Array Size : 1460417280 (1392.76 GiB 1495.47 GB)
Used Dev Size : 1460417280 (1392.76 GiB 1495.47 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent

Update Time : Sun Apr 18 18:53:10 2010
State : clean, recovering
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

Layout : left-symmetric
Chunk Size : 64K

Reshape Status : 58% complete
Delta Devices : 2, (2->4)

Name : DS410-NAS1:2 (local to host DS410-NAS1)
UUID : e37974ee:08cde55e:3111afd1:09915412
Events : 20570

Number Major Minor RaidDevice State
0 8 19 0 active sync /dev/hdb3
2 8 3 1 active sync /dev/sda3
4 8 51 2 active sync /dev/hdd3
3 8 35 3 active sync /dev/hdc3
DS410-NAS1>

Thanks a lot for all your help.

alli_yas 04-22-2010 07:28 AM

Quote:

1. Errrr... RAID1 with 2 disks will not protect against 2 disk failures. Use raid6 then
100% Correct - was a typo on my part - meant to say RAID 1 will protect against disk failure for 2 disks.

Quote:

2. RAID1 is mirroring. I would expect a bigger performance using raid0. Unless there is some good programming logic that uses 2 disks seperately to read data(I don't know if that is the case.).
I do know what RAID 1 is - as I said I administrate storage. As I said, the performance gain will be double the speed for READ operations against a mirror. In an enterprise environment; your RAID controller or Storage Processor allows this doubling in speed. If you're using a low end RAID controller or software read your point around having application level programming logic to read from the disks concurrently does apply.

In the same vein, write operations will suffer increased latency.


All times are GMT -5. The time now is 03:07 AM.