Raid 1 with different sized disks

From SynologyWiki
Revision as of 10:16, 2 August 2010 by Possumpie (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I recently found a need to create a RAID 1 from two different sized disks (without losing usable disk space) so I thought I'd document how I did it here.
NOTE VERY WELL: Synology doesn't support this. You may lose data, void warranty etc. Always back up your data before trying stuff like this
NOTE also that on newer versions of the firmware the second volume won't appear. Still working on a solution...

My Setup

DS207+ running DSM 2.2-0959 firmware
1x WD 500GB nearly full with data
1x Seagate 1TB new & empty

I wanted 1 500GB RAID 1 partition for the data that I really care about, and the remaining 500GB on the larger disk to be still writable.

Steps

Disclaimer: This is the way that worked for me. It looks (in retrospect) that there are a few places where shortcuts could be taken. if you want to try it, be my guest - if it works you can update this page for everyone else :-)
1) insert new drive into syno.
2) use web UI to "upgrade" volume to RAID1 (will take a long time, possibly not required. See disclaimer above)
3) follow instructions at How_to_downgrade_a_RAID_1_Volume_to_Non-RAID to turn your 2 disk RAID 1 into a 1 disk RAID 1 volume. See my notes in the discussion section if you get stuck (like I did).
after rebooting, you should have something similar to the following configuration

DiskStation> fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1               1         310     2490043+  fd  Linux raid autodetect
/dev/sda2             311         375      522112+  fd  Linux raid autodetect
/dev/sda3             392       60801   485243325   fd  Linux raid autodetect

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1               1         310     2490043+  fd  Linux raid autodetect
/dev/sdb2             311         375      522112+  fd  Linux raid autodetect
/dev/sdb3             392       121601   488376000   fd  Linux raid autodetect

4) Now run

fdisk /dev/sdb

and delete the partition on the disk you want to split. In my case this is /dev/sdb3. Create a new partition the same as on the other disk, and another with the remaining (Note that for some reason synology doesn't seem to support extended partitions, so you can only have 4 partitions on each disk).
Your second disk should now look like this:

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1               1         310     2490043+  fd  Linux raid autodetect
/dev/sdb2             311         375      522112+  fd  Linux raid autodetect
/dev/sdb3             392       60801   485243325   fd  Linux raid autodetect
/dev/sdb4           60802      121601   488376000   83  Linux

After double checking that all your data is backed up, you can now write the new partition table out and exit fdisk.
5) reboot. Then run

mdadm --add /dev/md2 /dev/sdb3

(or the partition you want in the RAID array) followed by

mdadm --grow --raid-disks=2 /dev/md2

If you log into the web interface you should now see "synchronizing" with a percentage completion for volume 1.

6) once the synchronizing is complete, run

mkfs.ext3 /dev/sdb4

to format your non-RAID partition. You can then add this line to /etc/fstab

/dev/sdb4 /volume2 ext3 defaults 0 0

NOTE: the disk station will overwrite this file at start up. If you want this to persist beyond a reboot, you'll have to find a way to insert it into this file at bootup. For me with the configuration above, this worked:
add the following on line 293 of /etc/rc

# HACK - This line allows the non-raid partition of the larger drive to be visible     
echo "/dev/sdb4 /volume2 ext3 defaults 0 0" >> /etc/${FStab}

so that it looks like this

# initial findhostd first to report quota check progress, see DS20 bug #
/usr/syno/etc/rc.d/S98findhostd.sh start
                               
# HACK - This line allows the non-raid partition of the larger drive to be visible     
echo "/dev/sdb4 /volume2 ext3 defaults 0 0" >> /etc/${FStab}
                   
UsrVolumeList=`grep /volume /etc/${FStab} |awk '{printf("%s:%s \n", $1, $2)}'`

7) type

mkdir /volume2
mount /volume2

8) reboot, log into web UI again to check that volume2 is recognised.

Personal tools
Community Resources