0

Is it possible to install software RAID 1 on a single disk Debian server without erasing/format the data on the original disk?

What approach would you recommend?

Chrille
  • 463
  • 2
  • 5
  • 10
  • WHY would you do that? On a single disc there is no advantage at all to use RAID 1 - only disadvantages (writes REALLY get slower). – TomTom Mar 02 '12 at 06:59
  • It can be done but why would you ever have a need for this?!... – DaffyDuc Mar 02 '12 at 07:24
  • The reason is redundancy, I don't need the extra speed with RAID 0, just the security if one disk fails. – Chrille Mar 02 '12 at 11:24
  • How will you have redundancy with only one disk ? – Gregory MOUSSAT Mar 02 '12 at 18:10
  • I don't think he means to use a single disk all along. He has a single disk right now and wants to plug in another and convert to a RAID1. But even with a single disk you would get some amount of redundancy against bad blocks - ZFS for example has [*ditto blocks*](http://www.c0t0d0s0.org/archives/3107-Ditto-data-blocks-in-ZFS.html) which is quite similar when set on a storage pool with a single physical disk. – the-wabbit Mar 02 '12 at 20:58

1 Answers1

0

You can. I don't understand why you want only one disk, but you can. And this won't slow your disk accesses.

You need to shrink the filesystem to make sure there is 128K free at the end of the device, because Linux software RAID need it:

umount /
resize2fs /dev/xxx your_size
mdadm --create /dev/mdx --raid-devices=2 --level=raid1 /dev/xxx missing
mount /dev/md0 /xxxxx

I strongly suggest you to test it with a dummy computer or a virtual machine.

Gregory MOUSSAT
  • 1,673
  • 2
  • 25
  • 50
  • Ok, it sounds like it's nothing you recommend? Would it be better to set up a new server with configured RAID and migrate all data to it? – Chrille Mar 02 '12 at 11:25
  • Seems you are not aclimated with software RAID and/or Linux, so I suggest you to test before playing with datas. The procedure itself is simple and relatively safe, but Murphy's watching you. – Gregory MOUSSAT Mar 02 '12 at 18:13