How to setup RAID without loosing existing data?

Klingon

n00b
Joined
Jan 7, 2004
Messages
30
So I've got one 1TB Hitachi and one 1TB Samsung.

My plan is to buy another two 1TB disks and then make a RAID out of all 4.
Problem is that I already filled my two existing drives to the brim, and I do not wish to loose this data.
Can I create a single RAID using all 4 disks and still keep my data?
 
Can I create a single RAID using all 4 disks and still keep my data?

Not really.

However, and don't quote me on this as I haven't tried it yet, but IIRC with Linux MDADM RAID, you can setup two drives as part of a degraded RAID 5 array and still keep the data on it. Then add in the additional drives, rebuild the array, and you should have a RAID 5 array with all of your data safe.

Alternatively, set up the new drives into a degraded RAID 5 array in Linux, hook up your old 1TB drives, copy the data over, and then add the old 1TB drives to the RAID array. Rebuild the array, and you should have a RAID 5 array with all of your data safe.

With that said, haven't tried it nor can I vouch for it. Just something I remember
 
Are your existing two 1TB drives of the same class/platter density?

Do you have a proper backup solution? What is your reason for a RAID0 volume of 4x1TB; storage space or speed?
 
The two drives are:
1. Samsung SpinPoint F1 SATA2 1TB 7200 RPM, 32MB cache, SATA2
2. Hitachi Deskstar™ 7K1000.C 1TB7200RPM, 3,5", 32MB Cache, SATA 3Gb/s

I don't have any backup at all :D

My reason for creating a raid is storage only. Speed-wize I only need to be able to stream 1080p mkvs from it.
 
In that case i would advise to setup something like FreeNAS+ZFS and use 4 HDDs in RAID-Z with snapshots, and stream over the network. You don't need that much speed just to stream 1080p content.

That allows you both 'backup' (well history) and redundancy. As with 4 disks in RAID0 you could be in for a surprise. Unless you say the data stored on this volume does not need any protection. Just want to avoid headaches on your end.
 
Ok

I'm on a budget here. My box is currently setup with Ubuntu server and works well. My motherboard does not have a RAID chip however. I cannot afford a "real" RAID controller, meaning one of those that starts at 400$. So what are my options?

Also how does RAID-Z work, will it allow me to utilize the storage space of all the disks?
 
I'm on a budget here. My box is currently setup with Ubuntu server and works well. My motherboard does not have a RAID chip however. I cannot afford a "real" RAID controller, meaning one of those that starts at 400$. So what are my options?

Well you have two options:
1) Linux MDADM RAID
2) FreeNAS/FreeBSD ZFS setup.
 
Note that you do not need a RAID controller for the Linux/BSD option. You need SATA ports that can work in AHCI mode. That often means the Serial ATA ports on your motherboard; these are the highest quality you can have, basically.

I think FreeNAS is an excellent NAS OS to begin with. Ubuntu server would be more of a workstation; no web-GUI here and you also lack ZFS; but you may have a more generic workstation OS that also functions as NAS.
 
Note that you do not need a RAID controller for the Linux/BSD option. You need SATA ports that can work in AHCI mode. That often means the Serial ATA ports on your motherboard; these are the highest quality you can have, basically.

I think FreeNAS is an excellent NAS OS to begin with. Ubuntu server would be more of a workstation; no web-GUI here and you also lack ZFS; but you may have a more generic workstation OS that also functions as NAS.

Aha. I thought FreeNAS was dependant on hardware. So its a software RAID NAS OS using FreeBSD linux bascially...

Apologies if I come off daft but I'm kind of new to the whole RAID thing.

When it comes to backup I think I will "borrow" some storage off a friend and dump my data there, then create the RAID and put the data back. Safest way.

I got some more questions now

1. Does FreeNAS also provide you with a SSH Console? Reason I ask is that my Ubuntu server currently have a ftpd installed, a functionality I would like to keep. I know that I could build a seperate NAS box and keep my Ubuntu box, but as mentioned I'm on a budget so preferably it would be nice to have both in one.

2. If I create a RAID Z with FreeNAS do I then create a filesystem of the RAID or how does that work. Which filesystem type should I use?
 
FreeNAS is a FreeBSD-based NAS OS with Web-GUI; some parts of FreeBSD removed and other parts added (like php and the webserver and all the scripts that make the web-GUI work). However, FreeBSD is not Linux; though it can be seen as an alternative or even competitor to Linux. FreeBSD has a more liberal (free) license than Linux; this is an advantage since it has no problems using CDDL-licensed ZFS software by Sun/Oracle. So FreeBSD can support more modern foreign technologies than Linux can, which i think is an advantage.

As a side note, the kFreeBSD project aims at integrating the FreeBSD kernel in the Ubuntu/Debian OS; meaning it is not Linux anymore but rather based on the FreeBSD kernel - still with Ubuntu functionality and style; the user might not experience any difference.

Regarding your questions:

1. Yes you can have SSH console with FreeNAS. It also supports FTP and other protocols; virtually all i think.

2. If you are going to use ZFS, then ZFS is both Filesystem and RAID-engine in one. So one package. You simply create a RAID-Z array (RAID5) and nearly instantly it will be created and mounted and ready for use. The FreeNAS GUI can deal with some ZFS functions, though for other stuff you would still need the command line (SSH).

Generally ZFS is very maintenance-free. You don't have to do a disk check ever; ZFS fixes damage on the spot and on-line; there is no offline disk check for ZFS. Once you discover how snapshots work you can use these as automated 'backups'. For example if you snapshot every day and remove snapshots older than 14 days, then you would have a rolling backup system where you can go back in time up to 2 weeks to restore files that were in the exact condition at that time. Just like a backup you created at that date.

So for example a Windows-virus infects alot of files on your mounted FreeNAS ZFS volume; then you rollback a snapshot of yesterday and you've restored everything again. Incredibly useful feature; plus ZFS snapshots are very space efficient (only stores data that was changed relative to the last snapshot) and have near-instant creation time.
 
Thank you for your thorough answer.

Can you also help me explain a bit about RAID-Z (RAID5). Will RAID-Z on a 4x1TB disk system give me 4TB or will some of the space be reserved? So if one of the disks shorts out, I can simply replace it with a new one and I'm back up and running?
 
RAID-Z is like RAID5; that means you can lose one disk without losing any data. You can then replace that disk and rebuild or 'resilver' process will start. The parity would consume one disk; so with 4 disks you have 25% parity overhead. That means 4x 1TB disks yield 3TB of usable space.

You should also keep in mind that ZFS likes to have spare space, so do not make the filesystem more full than 80% is generally good practice.

You may want to read about ZFS on the wikipedia page, or watch some youtube videos; just to get the feeling of what ZFS can do and how it can make your life easier when properly used.
 
Thanks sub.mesa.

Got some more questions

- Does software RAID require my 1TB to be of same make and model? Or can they be different models/make, i.e. different platter density and RPMs?
- If I run out of SATA ports on my mainboard, can I (in the future) easily expand my software RAID by adding a SATA controller card and just build on the RAID using disks connected to the controller as well?
 
You can use different type of disks; but generally i recommend to keep the rpm and platter density the same; this will determine performance and if you mix different disks the slowest may dictate the performance level.

So you can mix Seagate/Hitachi 1TB disks; but i would keep them the same platter density and rpm.

You can use any Serial ATA port; ZFS is totally software RAID; you could even connect everything via USB and it would still be detected by ZFS. So it doesn't really matter how you connect your disks. I do recommend using full bandwidth; thus onboard Serial ATA, if those are full you can add some PCI-express addon controller and use the extra ports there. It does not matter where you connect your disks; you can swap all the cables when the system is powered off. When you power on again, ZFS would still detect your array even though you changed the location of all HDDs.

Thus, with software RAID you have some flexibility over a hardware RAID configuration.
 
You can use any Serial ATA port; ZFS is totally software RAID; you could even connect everything via USB and it would still be detected by ZFS.

the funny thing is i've been really bored lately. haven't even begun looking, but i got all these free 8gb memory sticks with my ram and have been contemplating trying to set them up in raid 0 for god knows what xD

i think mdadm would be my only option, though. not a big deal, i can probably do that via cygwin?
 
You can use different type of disks; but generally i recommend to keep the rpm and platter density the same; this will determine performance and if you mix different disks the slowest may dictate the performance level.

So you can mix Seagate/Hitachi 1TB disks; but i would keep them the same platter density and rpm.

You can use any Serial ATA port; ZFS is totally software RAID; you could even connect everything via USB and it would still be detected by ZFS. So it doesn't really matter how you connect your disks. I do recommend using full bandwidth; thus onboard Serial ATA, if those are full you can add some PCI-express addon controller and use the extra ports there. It does not matter where you connect your disks; you can swap all the cables when the system is powered off. When you power on again, ZFS would still detect your array even though you changed the location of all HDDs.

Thus, with software RAID you have some flexibility over a hardware RAID configuration.

Been reading up on ZFS. As I am going to create a RAIDZ (RAID5) I encounter bit of a predicament as I currently have two full single 1TB disks, and I bought 3x new empty 1TB disks.

My plan is as follow

1. zpool create vol0 raidz /dev/newdisk1 /dev/newdisk2 /dev/newdisk3
2. Copy all the data from my current full 2x1TB disks to the new raid array
3. Include the 2x1TB disks to the raid.

As I see it this would allow me to keep my data whilst making use of all my disks.
However reading the doc ZFS pools on https://wiki.ubuntu.com/ZFS/ZPool it says that if I am to add extra disks to an existing RAIDZ pool I need to match the amount of devices.

So 3 + 2 does not add up obviously.

Could I split one of the old disks in two partition and then end up with 3 partitions on 2 disks? I.e. /dev/sda /dev/sdb1 /dev/sdb2

Any reccomendations?
 
First off: It looks like you're using zfs-fuse? You're going to be in for a lot of headaches
zfs-fuse uses ZFS v13
freebsd 7.3 is using ZFS v13
freebsd 8.1 is using ZFS v14
In comparision
OpenSolaris b134 uses ZFS v24
Just something to think about
 
First off: It looks like you're using zfs-fuse? You're going to be in for a lot of headaches
zfs-fuse uses ZFS v13
freebsd 7.3 is using ZFS v13
freebsd 8.1 is using ZFS v14
In comparision
OpenSolaris b134 uses ZFS v24
Just something to think about

In for a headache why? Do you have a better alternative for software RAID5 on ubuntu?
 
No That's why I switched to OpenSolaris with ZFS :)

Our needs were basically AMP stack, and Webstack in OpenSolaris gives us exactly that, so it was relatively easy for us as a company to switch

Plus Virtualbox for those pesky Windows servers
Otherwise, sticking with Ubuntu, I think you'll have to go mdadm route. :(
 
vraa: ZFS v24 is not labeled as stable yet; no stable OpenSolaris release has anything higher than v14 afaik.

You have to separate stable ZFS from development ZFS; you would have to run a development version to use ZFS v24 at the moment. So FreeBSD and OpenSolaris are evenly matched regarding stable ZFS (v14). Though FreeBSD 8.0 still has v13; the 8-STABLE carries v14 just like the latest stable OpenSolaris release.
 
vraa: ZFS v24 is not labeled as stable yet; no stable OpenSolaris release has anything higher than v14 afaik.

You have to separate stable ZFS from development ZFS; you would have to run a development version to use ZFS v24 at the moment. So FreeBSD and OpenSolaris are evenly matched regarding stable ZFS (v14). Though FreeBSD 8.0 still has v13; the 8-STABLE carries v14 just like the latest stable OpenSolaris release.
You are right, my mistake, I sometimes forget not everyone can run /dev

And who knows when the next official stable will be out.
 
No That's why I switched to OpenSolaris with ZFS :)

Our needs were basically AMP stack, and Webstack in OpenSolaris gives us exactly that, so it was relatively easy for us as a company to switch

Plus Virtualbox for those pesky Windows servers
Otherwise, sticking with Ubuntu, I think you'll have to go mdadm route. :(

Well this is for personal use. I am not after performance only stability and redundance. What are the headaches you mention?
 
No That's why I switched to OpenSolaris with ZFS :)

Our needs were basically AMP stack, and Webstack in OpenSolaris gives us exactly that, so it was relatively easy for us as a company to switch

Plus Virtualbox for those pesky Windows servers
Otherwise, sticking with Ubuntu, I think you'll have to go mdadm route. :(

You have yet to explain the problem with ZFS on ubuntu....
 
There is still something that is not clear to me when it comes to RAID5 in general...

If I want to add more storage space to my array do I have to add the same amount of disks that the array currently exists of, or can I add just one disk? (same size ofcourse).

Does ZFS support this?
 
There is still something that is not clear to me when it comes to RAID5 in general...

If I want to add more storage space to my array do I have to add the same amount of disks that the array currently exists of, or can I add just one disk? (same size ofcourse).

Does ZFS support this?
In regards to RAID 5, you can add one disk and you'll be fine. Just make that the new disk of equal or greater size to the rest of the drives in the RAID 5 array.

ZFS works a bit differently than RAID 5. There is a rather decent ZFS guide here on the forums that explains that:
http://hardforum.com/showthread.php?t=1500505

The above guide also kind of backs up vraa's statement on ZFS and Linux.
 
In regards to RAID 5, you can add one disk and you'll be fine. Just make that the new disk of equal or greater size to the rest of the drives in the RAID 5 array.

ZFS works a bit differently than RAID 5. There is a rather decent ZFS guide here on the forums that explains that:
http://hardforum.com/showthread.php?t=1500505

The above guide also kind of backs up vraa's statement on ZFS and Linux.

Aha I get it now.

So I will need to go with mdadm then. Does it support adding a single disk to a RAID5 array?
 
Setup my RAID5 using mdadm successfully now.

1. Created array using the new 3x1TB disks
2. Copied over data from old 2x1TB disks
3. Included old disks to array
4. regrow, resize. Voila!

Seems to be working fine, will be monitoring it closely.

Some questions:

- How often should I run a fsck on the array? (its ext3)
- Below is the result of hdparm -tT run, is this within the normal or should I be getting alot more?

/dev/md0:
Timing cached reads: 1934 MB in 2.00 seconds = 967.04 MB/sec
Timing buffered disk reads: 440 MB in 3.01 seconds = 146.30 MB/sec

Box info
CPU: E1500 @ 2.20GHz
Mobo: Value gigabyte. Using on-board 4xSATA
RAM: 1GB DDR2
Disks: 3x WD Green (7.2K RPM), 1x Hitatchi (7.2k RPM), 1x Samsung spinpoint (7.2k)
 
Are you using Ubuntu at the moment? If so, check out the Disk Utility which can do benchmarks of raw devices. The write test destroys data though; so don't do the write test unless you are okay with recreating the filesystem (ext3) and losing all files on the volume.

You can also use dd to test throughput, if you know the mountpoint of your mounted array:

# write test
dd if=/dev/zero of=/mounpoint/zerofile.000 bs=1M count=1000

# unmount and remount to trash file cache; if we don't do this it can yield incorrect numbers
umount /mountpoint
mount /mountpoint

# read test
dd if=/mountpoint/zerofile.000 of=/dev/null bs=1M

Note that /mountpoint is not /dev/ ! /mountpoint is where you mounted the ext3 filesystem of your array.
 
Back
Top