# Is it possible to turn an already installed system into RAID0?



## cabriofahrer (May 16, 2016)

I have FreeBSD amd64 10.3 already installed on a single SATA drive (ada0) and I have other spare drives for additional data storage:


```
$ dmesg | grep ada
ada0 at ata2 bus 0 scbus2 target 0 lun 0
ada0: <SAMSUNG HD160JJ WU100-41> ATA-7 SATA 2.x device
ada0: Serial Number S08HJ1QL907862
ada0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada0: 152627MB (312581808 512 byte sectors)
ada0: Previously was known as ad4
ada1 at ata3 bus 0 scbus3 target 0 lun 0
ada1: <SAMSUNG HD160JJ WU100-41> ATA-7 SATA 2.x device
ada1: Serial Number S08HJ1QL907857
ada1: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada1: 152627MB (312581808 512 byte sectors)
ada1: Previously was known as ad6
ada2 at ata4 bus 0 scbus4 target 0 lun 0
ada2: <SAMSUNG SP1614C SW100-30> ATA-7 SATA 1.x device
ada2: Serial Number 00000000000000
ada2: 150.000MB/s transfers (SATA 1.x, UDMA5, PIO 8192bytes)
ada2: 152627MB (312581808 512 byte sectors)
ada2: Previously was known as ad8
ada3 at ata5 bus 0 scbus5 target 0 lun 0
ada3: <ST3160827AS 3.42> ATA-6 SATA 1.x device
ada3: Serial Number 4MT0ADSG
ada3: 150.000MB/s transfers (SATA 1.x, UDMA5, PIO 8192bytes)
ada3: 152627MB (312581808 512 byte sectors)
ada3: Previously was known as ad10
Trying to mount root from ufs:/dev/ada0p2 [rw]...
```

Ada0 and ada1 are the same and could therefore become a RAID0 array together. Is it possible to "merge" ada0 and ada1 to a RAID0 without losing my installation following the steps of chapter 18.2 of the Handbook? And if not, how are you supposed to create a software RAID0 system with FreeBSD without using the hardware option in the BIOS prior to committing to the installation? Because one of the advantages of software RAID with FreeBSD is that you can have it even without a RAID controller, right?

Another question: would my ada2 and ada3 be compatible for a second RAID0, let's say, in another PC? Also there I would need to know how to proceed with a fresh installation in order to create a software RAID0? ZFS is not an option to me, as I only have 2 GB of RAM.


----------



## kpa (May 16, 2016)

ZFS is a realistic option even with 2GBs of memory, you'll just need to do some tuning to limit the maximum size of the ARC cache to something sensible like 512MBs.

https://wiki.freebsd.org/ZFSTuningGuide#Generic_ARC_discussion


Otherwise it's a better idea to backup the whole system and build the new disk layout, be it gstripe(8), gmirror(8) or ZFS,  from scratch and restore the system to the new layout from the backup.


----------



## cabriofahrer (May 16, 2016)

Thank you, but I still don't like the idea of ZFS and I would really like to stick to UFS.



kpa said:


> Otherwise it's a better idea to backup the whole system and build the new disk layout



Allright, but how exactly do I do this? I think bsdinstall does not offer that option? The partition tool would recognize the hard drives and alternatively offer ZFS. So how do I implement the gstripe(8) solution at the beginning of an installation process, so that FreeBSD gets installed onto that RAID0 system?


----------



## Chris_H (May 18, 2016)

The easiest option for what you're attempting to do, is by way of geom(8) CONCAT. Some might argue that it's not the best route to take. But I can speak from experience, that this method served me well, for _years_ without _any_ issue -- _very_ dependable.  It's _easy_, too!

--Chris


----------



## wblock@ (May 19, 2016)

Do you really mean RAID0?  As in faster but twice as likely to fail as a single disk?  If you just need more space, that's not necessary.  Partition the extra drives and make separate filesystems on them.  That can be done without having to move the existing system to a whole new device.


----------



## PacketMan (May 26, 2016)

wblock@ said:


> If you just need more space, that's not necessary.  Partition the extra drives and make separate filesystems on them.  That can be done without having to move the existing system to a whole new device.



Yeah that is what I did. Simple, clean, works, reliable.


```
$ pwd
/nasdisk1
$
```

I simply followed Section 17.2 Adding Disks from the handbook.
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html


----------



## cabriofahrer (Jun 8, 2016)

Thanks so far for giving other ideas about gaining disk space, but yes I would really like to do a fresh install on a RAID0 system with UFS.



Chris_H said:


> The easiest option for what you're attempting to do, is by way of geom(8) CONCAT. Some might argue that it's not the best route to take. But I can speak from experience, that this method served me well, for _years_ without _any_ issue -- _very_ dependable.  It's _easy_, too!
> 
> --Chris



Could you please elaborate? Exact steps? So far I know that in bsdinstall, when you get to the partitioning part you can select "shell". And I guess then I would have to do

`gpart destroy -F ada0`
`gpart destroy -F ada1`
`gpart create -s gpt ada0`
`gpart create -s gpt ada1`

And to create the stripe something like `gstripe label st0 /dev/ada0 /dev/ada1` or rather `gstripe label st0 /dev/ada0p1 /dev/ada1p1`, so stripe a previously created slice? And see, this is where my lack of knowledge starts: I would also need a boot and a swap partition, right? But are these created on the stripe `/dev/stripe/st0` or twice on ada0 and ada1 and then only the freebsd-ufs partitions are striped?

On the other hand chapter 18.2 of the FreeBSD Handbook suggests doing `gstripe label -v st0 /dev/ada0 /dev/ada1` on "unpartitioned" disks and then `bsdlabel -wB /dev/stripe/st0`, but wouldn't that be dangerously dedicated? It is all so confusing, so could someone please explain the exact steps/commands necessary to install FreeBSD onto a UFS-RAID0 stripe?


----------



## Phishfry (Jun 19, 2016)

I also see an example that seems relevant in the gconcat(8) manual.

I have been meaning to try this out myself as I prefer UFS for simplicity and SSD durability seems quite high these days.

I would eliminate swap partition myself. I also think /boot can be a directory on your stripe with MBR.


----------



## cabriofahrer (Jun 20, 2016)

Phishfry said:


> I also think /boot can be a directory on your stripe with MBR.



I am not so sure about that. Can you really create a freebsd-boot partition on a stripe, or would it not rather be necessary to have the freebsd-boot partition on a real device like ada0, so that the computer will be able to bootstrap at all, load the geom_stripe.ko module, as would be specified in /boot/loader.conf, to the be able to load the stripe, as would be specified in /etc/fstab?


----------



## Phishfry (Jun 20, 2016)

I think this is possible. Maybe with MBR or GPT.
http://daemon-notes.com/articles/system/install-ufs/begin

My 10.3 AMD64 MBR install has only one partition (freebsd) flag=active and two slices.
freebsd-ufs
freebsd-swap


----------



## Phishfry (Jun 21, 2016)

Trying to do this with 160GB hard disk drives is not good. They are like 9 years old.

I am not sure `gstripe(8)` is directly bootable.(thank you WB@)

I have dual bay possible in my notebook. May just have to try.
RootOnZFS is the most common implementation of root on raid from my reading.
https://wiki.freebsd.org/RootOnZFS


----------

