Skip to content

Partitioning and RAID

tobiaswaldvogel edited this page Oct 25, 2012 · 10 revisions

Currently disk partitioning is not integrated in the web interface.
This is a summary of the most important commands for disk partitioning and RAID.

Setting up partitions

There are two different type of partition tables:
MBR (traditional) partition tables, which are limited to 2TB -> Use fdisk
GPT (GUID) partition tables -> Use gdisk

I recommend using GPT partition tables, especially for big drives


There are a lot of different options, depending if you want more storage or safety. Usually most are interested in RAID 1. This gives you only 50% of the total capacity, but you don't lose anything on a disc failure, which is likely to happen one day.

Basically you have to options: Creating first the RAID array and on top partitions or creating first partitions and on top the RAID volumes. I prefer usually the second option, as it gives you more flexibility, especially with different drives sizes. By the way, usually it is recommend using two different drives, then it is less likely that they fail at the same time.

Usually I set up first a small SWAP partition, although I never mount it. But at least it is available in case that I should need it for huge filesytem check (EXT4).

So, let's assume you have partitioned your discs in the following way:

/dev/sda1 swap (512MB) /dev/sda2 (almost the whole disc)
/dev/sdb1 swap (512MB) /dev/sdb2 (almost the whole disc)

Then you would create a RAID 1 over /dev/sda2 and /dev/sdb2.

mdadm --create --metadata=1.2 --level=1 --name=0 --raid-devices=2 --bitmap-chunk=65536k /dev/md0 /dev/sda2 /dev/sdb2

Now you have a new device /dev/md0, which is stored on /dev/sda2 and /dev/sdb2 as mirror. On the next startup your RAID array is reassembled automatically.

Your RAID array is now built, which may take several hours. Anyway you can use it already in the meanwhile, although with reduced performance.

As a final step you can the following command to create a bitmap. By this mdadm tracks the last changes and if there should be a power failure there is no need for a full resync:

mdadm /dev/md0 -Gb internal

Create a filesystem

It has turned out the XFS is the best file system for most purposes. I consumes much less resources than EXT4, which is particular important on a small NAS like this one. for XFS there is no need for any additional options. Just use

mkfs.xfs /dev/md0

Create a mount point

This last step can performed from the web interface. Just create a new entry in System -> Mount Points and tell where you want to mount /dev/md0. I prefer usually /mnt/md0, but you can choose whatever you want.

Back to overview

You can’t perform that action at this time.