On 07/24/2014 06:07 PM, Les Mikesell wrote:
On Thu, Jul 24, 2014 at 7:11 PM, Lists lists@benjamindsmith.com wrote:
I have a large disk full of data that I'd like to upgrade to SW RAID 1 with a minimum of downtime. Taking it offline for a day or more to rsync all the files over is a non-starter. Since I've mounted SW RAID1 drives directly with "mount -t ext3 /dev/sdX" it would seem possible to flip the process around, perhaps change the partition type with fdisk or parted, and remount as SW RAID1?
I'm not trying to move over the O/S, just a data paritition with LOTS of data. So far, Google pounding has resulted in howtos like this one that's otherwise quite useful, but has a big "copy all your data over" step I'd like to skip:
http://sysadmin.compxtreme.ro/how-to-migrate-a-single-disk-linux-system-to-s...
But it would seem to me that a sequence roughly like this should work without having to recopy all the files.
- umount /var/data;
- parted /dev/sdX (change type to fd - Linux RAID auto)
- Set some volume parameters so it's seen as a RAID1 partition
"Degraded". (parted?) 4) ??? Insert mdadm magic here ??? 5) Profit! `mount /dev/md1 /var/data`
Wondering if anybody has done anything like this before...
Even if I found the magic place to change to make the drive think it was a raid member, I don't think I would trust getting it right with my only copy of the data. Note that you don't really have to be offline for the full duration of an rysnc to copy it. You can add another drive as a raid with a 'missing' member, mount it somewhere and rsync with the system live to get most of the data over. Then you can shut down all the applications that might be changing data for another rsync pass to pick up any changes - and that one should be fast. Then move the raid to the real mount point and either (safer) swap a new disk, keeping the old one as a backup or (more dangerous) change the partition type on the original and add it into the raid set and let the data sync up.
I would, of course, have backups. And the machine being upgraded is one of several redundant file stores, so the risk is near zero of actual data loss even if it should not work. :)
And I've done what you suggest: rsync "online", take apps offline, rsync, swap, and bring it all back up. But the data set in question is about 100 million small files (PDFs) and even an rsync -van takes a day or more, downtime I'd like to avoid. A sibling data store is running LVM2 so the upgrade without downtime is underway, another sibling is using ZFS which breezed right through the upgrade so fast I wasn't sure it had even worked!
So... is it possible to convert an EXT4 partition to a RAID1 partition without having to copy the files over?