vinay25 / snake-os

Automatically exported from code.google.com/p/snake-os
0 stars 0 forks source link

Installing RAID-1 for SnakeOs #249

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, I recently bought a NAS to put it on my home network, searching on the 
web I found the NS-K330, that is very cheap. Because it has two possible usb 
drive, I thought of putting them in raid1. Was not possible in the original 
firmware, so I changed to SnakeOs. The Version 1.3.2 (20111126) I downloaded 
seems to work fine, yet I have not tested much.

I've been looking on the web to turn SnakeOs on raid1, but I see that official 
development has it TODO. For my part I have started a particular solution, 
which will account below.

About the source code for version 1.3.2-392 that can be downloaded, have made 
the following changes:

1) I turned on the next menuconfig options:

   - Device Drivers
   - Multi-device support (RAID and LVM)
   [*] Multiple devices driver support (RAID and LVM)
   [M] RAID support
   [M] RAID-1 (mirroring) mode

2) I put in the "apps" a copy of "mdamdm-2.5.6" which seems the version closest 
in time to the kernel 2.6.16, and I have included it into the Makefile to 
compile as an application.

When I compiled the SnakeOs, I collected from the "rootfs/target" the following 
files:

   bin/mdadm
   lib/modules/2.6.16-gazineu/kernel/drivers/md/md-mod.ko
   lib/modules/2.6.16-gazineu/kernel/drivers/md/raid1.ko

On the NAS I have connected two identical disks of 500GB, partitioned the same:

   -Partition1 (sda1 and sdb1): 40GB
   -Partition 2 (sda2 and sdb2): 460GB (All the rest)

Have been formatted with ext2, ext3 has journaling since and it means to write 
more over the disc. In the sda1 has created the directory "raid1" and  copied 
the three files above mentioned.

To create the raid has been used telnet:

1) Install the modules:
 # insmod / sda1/raid1/md-mod.ko
 # insmod / sda1/raid1/raid1.ko

 Check That modules are running
 # Lsmod

2) Define the raid
 # mknod / dev/md0 b 9 0
 # mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2

3) mount the result
 # mkdir / usb/md0
 # mount / dev/md0 / usb/md0

Now the raid is already running, and synchronizing. You can see on the system 
log:
 - md: bind
 - md: bind
 - raid1: raid set md0 active with 2 out 2 mirrors

and also
 # cat /proc/mdstat

To set the raid in the boot startup, I create the file "nasraid" that has been 
copied to "/etc/init.d". I have not found a way to configure SnakeOs to run 
"nasraid" on each boot, so I've hooked to starting with the swap file 
"swapsvc." Pay attention, after modifying "/etc/init.d" you must save the 
configuration to remember the changes the next boot.

If anyone knows how and wants to do, I would like to make a package to install 
the raid, and that could be set up and manage "md0" from the web management.

As if anyone interested, I leave attached the files I've been talking. 
Greetings.

Original issue reported on code.google.com by xavil...@terra.es on 28 Nov 2011 at 10:11

Attachments:

GoogleCodeExporter commented 9 years ago
The concept of RAID on SNAKE OS is great and congratulations on getting this 
going. I am a novice so I wouldn't even try the steps but really look forward 
to a package when it arrives. If only I had the knowledge to help out.

Original comment by plamr...@gmail.com on 23 Feb 2012 at 10:52