LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Setting up NAS with Slackware (http://www.linuxquestions.org/questions/slackware-14/setting-up-nas-with-slackware-852992/)

GasPipe 12-29-2010 05:44 AM

Setting up NAS with Slackware
 
Hi,

I have been running FreeNAS on my server but lately it has proven to be too limited by it's features and upgrades are a bit too complex in my taste.
Well, I have 3x500GB and 1x2TB hdd and I need some advice how to RAID these devices.
I used ZFS before with the 3x500GB drives in "RAIDZ" mode and last week I added 2TB drive but I didn't have a clue how to add it to the pool. I know (now) that I can only add same size of disks to the raid setup and with ZFS I think I could setup 3x500GB drives as one virtual device and 2TB drive in stripe mode as another virtual device and create one pool from those virtual devices and they would appear as one big device.

Yeah, but that was before. Now I'm changing my system to Slackware because it offers the flexibility I'm looking for. And the question is, how should I setup my hard drives and which RAID modes so that I could have maximum capacity and one disk as a spare one, like in RAID5 mode. And which filesystem do you recommend?
I'm planning to use -current, because it has newer mdadm than current stable and 13.2 is just around the corner (planning to stick with it when released).

Let's say that I would like to add another 2TB drive in the future. How easy it is to set up for example to mirror (raid1) mode with the old 2TB drive?

I'd like to thank everyone who replies to my questions in advance because I'm really lost with this case!

yooy 12-30-2010 01:53 AM

I chekced unetbooting and Slax is only thing available.

how to setup linux NAS

GasPipe 12-30-2010 02:43 AM

Okay, let's forget that. There are 80gb hdds for about 5-10 euros so I can buy one of those instead.

How about other questions?

Slax-Dude 12-30-2010 02:31 PM

You can only make a RAID setup when all the components are of equal size, that is if you want to use all the disk space available of course...
The space of each component of the RAID will be limited to the size of the smallest component.

In other words, if you have 3 hard drives of different sizes (100GB, 120GB and 150GB) and decide to make a RAID0 out of them, you would end up with a logical drive of 300GB size, because only 100GB (the size of the smallest drive) would be used from the 120GB and 150GB drives.

As long as you use same size drives, you can always increase the size of the RAID by adding more drives and "growing" the filesystem.

In your case, you can make a RAID5 using the 3 drives of 500GB, which will give you 1TB (you loose a drive worth of space to parity data) or a RAID0 which will give you the full space of 1.5TB for data.
Keep in mind that RAID0 has no fault tolerance: if any one of the 500GB drive fails you loose all the RAID0 data (the 1.5TB).

I strongly suggest you read this first: http://en.wikipedia.org/wiki/RAID

tux_dude 12-31-2010 12:32 PM

Get two additional 2TB drives and replace the existing 3x500GB drives on a RAID5. You can also keep the existing 3x500GB and run an additional RAID array (great the play around with mdadm with a spare RAID).

If the additional 2TB drives are not currently in your budget, then create a RAID5 array with the 3x500GB drives as your primary storage. Use the 2TB drive to store non-critical data. You can setup the 2TB drive as a degraded RAID1. Once you get additional 2TB drive(s) you can added it to the degraded RAID1 and migrate your data. You can also migrate to additional RAID levels when you add additional drives.

As for file system, I personally am only familiar and comfortable to ext file systems. I am running ext4 on my RAID6 array with 9x1.5TB drives with a mixture of ext3/4 on the other independent drives. Ext4 is quite fast and stable. Plus the online expansion now works flawlessly.

GasPipe 12-31-2010 01:20 PM

Quote:

Originally Posted by tux_dude (Post 4208891)
Get two additional 2TB drives and replace the existing 3x500GB drives on a RAID5. You can also keep the existing 3x500GB and run an additional RAID array (great the play around with mdadm with a spare RAID).

Yup, getting two additional 2TB drives aren't currently in my budget. I'm planning to buy more drives along the next year but not immediately.

Quote:

Originally Posted by tux_dude (Post 4208891)
If the additional 2TB drives are not currently in your budget, then create a RAID5 array with the 3x500GB drives as your primary storage. Use the 2TB drive to store non-critical data. You can setup the 2TB drive as a degraded RAID1. Once you get additional 2TB drive(s) you can added it to the degraded RAID1 and migrate your data. You can also migrate to additional RAID levels when you add additional drives.

Oh, thanks buddy! That was just what I was looking for. I guess that's the way to go but is there a way to make a single drive, which contains two RAID arrays, one with the 3x500GB drives and one with the 2TB drive? And that drive could be mounted to some sensible place like /mnt/storage and it would appear as normal hdd.

Quote:

Originally Posted by tux_dude (Post 4208891)
As for file system, I personally am only familiar and comfortable to ext file systems. I am running ext4 on my RAID6 array with 9x1.5TB drives with a mixture of ext3/4 on the other independent drives. Ext4 is quite fast and stable. Plus the online expansion now works flawlessly.

Yeah, I guess ext4 is a pretty safe option as file system.
Thanks tux_dude, your answer was just what I was looking for.

Any other thoughts?

tux_dude 12-31-2010 02:25 PM

Quote:

Originally Posted by GasPipe (Post 4208943)
Oh, thanks buddy! That was just what I was looking for. I guess that's the way to go but is there a way to make a single drive, which contains two RAID arrays, one with the 3x500GB drives and one with the 2TB drive? And that drive could be mounted to some sensible place like /mnt/storage and it would appear as normal hdd.

You could, but you wouldn't gain anything from it. You will either loose a lot of space or loose the redundancy entirely. Keeping the 2TB drive on a separate array gives you the maximum usable space with the 3x500GB drive as your safe haven. This option also enable safer array expansion as you add more drives. To keep them in the same directory path, you can use /mnt/storage for the 3x500GB mount point and /mnt/storage/non-critical for the the 1x2TB drive.

If you must have a single mount point /mnt/storage then the safest option is to add the 2TB drive to the 3x500GB RAID5. This will only expand the array by 500GB, meaning you will loose a whole 1.5TB from the 2TB drive (quite a waste).

Here is how I would proceed for future expansion (especially if you have limit ports to connect the drives).
1. Create RAID5 with 3x500GB drives for 1GB usable space
2. Create degraded RAID1 with 1x2TB for 2TB usable space (non-redundant)
3. Mount RAID5 in 1 on /mnt/storage
4. Mount RAID1 in 2 on /mnt/storage/non-critical
5. Months later add another 2TB drive to RAID1 in 2. Usable space still at 2TB but now with redundancy
6. You can copy all the data from the 3x500GB RAID5 to the 2x2TB RAID1 which has double the storage. Assuming you have sufficient space for the critical and non-critical data 1TB.
7. At this point you can get rid of the RAID5 array (if you have limited drive ports) or re-purpose it for other storage.
8. Many more months later add another 2TB drive to the 2x2TB RAID1 and migrate to RAID5. This gives you 4TB of usable space.
9. Rinse and repeat as you purchase larger drives.

T3slider 12-31-2010 02:48 PM

You could always create an LVM on top of the 3x500GB Raid 5 array and 2x1TB Raid 1 array (initially degraded). Make each RAID array a PV (physical volume) and you can add both arrays to a VG (volume group) and create LVs (logical volumes) as you please. I have two RAID 1 arrays acting in an LVM on my server without trouble. I'm not sure if creating a degraded RAID 1 array would place extra burden on the disk, so that's something to look into, but that aside an LVM on top of two RAID arrays seems to be what you're looking for.

GasPipe 12-31-2010 04:04 PM

Quote:

Originally Posted by tux_dude (Post 4209001)
You could, but you wouldn't gain anything from it. You will either loose a lot of space or loose the redundancy entirely. Keeping the 2TB drive on a separate array gives you the maximum usable space with the 3x500GB drive as your safe haven. This option also enable safer array expansion as you add more drives. To keep them in the same directory path, you can use /mnt/storage for the 3x500GB mount point and /mnt/storage/non-critical for the the 1x2TB drive.

Yes I know that. I was looking for LVM solution like T3slider suggested. Sorry for not being clear enough. I think I blame the Brooklyn local 2 bottle ;-)

Quote:

Originally Posted by T3slider
You could always create an LVM on top of the 3x500GB Raid 5 array and 2x1TB Raid 1 array (initially degraded). Make each RAID array a PV (physical volume) and you can add both arrays to a VG (volume group) and create LVs (logical volumes) as you please. I have two RAID 1 arrays acting in an LVM on my server without trouble. I'm not sure if creating a degraded RAID 1 array would place extra burden on the disk, so that's something to look into, but that aside an LVM on top of two RAID arrays seems to be what you're looking for.

I haven't ever worked with LVM before but I found README file for it. I somehow always forget that should be the first place to look for hints :-)

But to be clear I ask this question:
Let's say that I have one 80GB drive for root, home and swap paritions.
I have 3x500GB RAID5 array.
I have 2x2TB RAID1 array (which I would later extend with another 2TB drive and migrate it to RAID5.)

It's possible to create from those two RAID arrays one big LVM partition which would be 3TB of size?

Thanks for your answers and happy new year!
I'll look into this tomorrow.

T3slider 12-31-2010 04:21 PM

Quote:

Originally Posted by GasPipe (Post 4209058)
But to be clear I ask this question:
Let's say that I have one 80GB drive for root, home and swap paritions.
I have 3x500GB RAID5 array.
I have 2x2TB RAID1 array (which I would later extend with another 2TB drive and migrate it to RAID5.)

It's possible to create from those two RAID arrays one big LVM partition which would be 3TB of size?

Yes, correct. You create the two RAID arrays and assign each RAID device (/dev/md* if you're using software RAID) to a physical volume. LVMs allow you to extend volume groups by adding physical volumes to it. Therefore, you would end up with one volume group containing two physical volumes (the two RAID arrays), for a total of 3TB of allocatable space. You then create one or more logical volumes within that volume group. In your case it looks like you just want one logical volume since you want to mount the whole 3TB under one directory (unless I misunderstood).

GasPipe 01-01-2011 02:23 PM

Ok, I have created two RAID arrays /dev/md0 (3x500GB RAID5) and /dev/md1 (1x2TB RAID1).
Quote:

mdadm --create /dev/md0 --level 5 --raid-devices 3 /dev/sdb1 /dev/sdc1 /dev/sdd1
Then I created two physical volumes /dev/md0 and /dev/md1.
Quote:

mdadm --create /dev/md1 --level 1 --force --raid-devices 1 /dev/sda1
And then I created volume group called "varasto" which contains both /dev/md0 and /dev/md1.
Quote:

vgcreate varasto /dev/md0 /dev/md1
Every command have succeeded properly.

After that I just checked vgdisplay and I got:
Quote:

--- Volume group ---
VG Name varasto
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 2.73 TiB
PE Size 4.00 MiB
Total PE 715398
Alloc PE / Size 0 / 0
Free PE / Size 715398 / 2.73 TiB
VG UUID Rx663t-tjZw-s0re-PWiq-kQyY-G735-Hi1HAT
And try to create one big logical volume:
Quote:

lvcreate -L 2.73TiB -n Varasto varasto
Rounding up size to full physical extent 2.73 TiB
Insufficient free extents (715398) in volume group varasto: 715654 required
I have tried to create volume group with just one raid array and /dev/md0 works properly but when I extend it with /dev/md1 I still got the same amount of space than before.

What now?

T3slider 01-01-2011 07:01 PM

Quote:

Originally Posted by GasPipe (Post 4209729)
And try to create one big logical volume:
Code:

lvcreate -L 2.73TiB -n Varasto varasto
Rounding up size to full physical extent 2.73 TiB
Insufficient free extents (715398) in volume group varasto: 715654 required


I think it's trying to round up to a barely higher value. It would be better to use
Code:

lvcreate -l 100%FREE -n Varasto varasto
which I believe would work.
Quote:

Originally Posted by GasPipe (Post 4209729)
I have tried to create volume group with just one raid array and /dev/md0 works properly but when I extend it with /dev/md1 I still got the same amount of space than before.

If you decide to instead extend the VG and the LV, remember to extend the filesystem as well. The command you would use would depend on the filesystem you use.

GasPipe 01-02-2011 03:13 AM

Quote:

Code:

lvcreate -l 100%FREE -n Varasto varasto
which I believe would work.
Thanks, that worked perfectly!

Quote:

If you decide to instead extend the VG and the LV, remember to extend the filesystem as well. The command you would use would depend on the filesystem you use.
Yup, that must have been something I forgot to do.


All times are GMT -5. The time now is 11:27 AM.