Rich Freeman on 16 Oct 2017 12:00:37 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Things to correct when copying over a filesystem with rsync?

On Mon, Oct 16, 2017 at 11:25 AM, Greg Helledy <> wrote:
>> Also, I'd hesitate to use the label "RAID-1" to describe your setup.
>> These are not really mirrored drives, in that anything you do to the
>> one isn't automatically reflected on the other, and you don't get the
>> other benefits of RAID like increased read performance.  There is
>> nothing wrong with how you're doing it, though you do need to be
>> careful to keep them equivalent.
> OK Rich, I have to admit that I did think I have RAID 1 with mirrored
> drives.  Isn't that what I have if I use mdadm to create a device labeled as
> raid 1?  Is there a link I should read to understand the difference between
> what I think I have and what I actually have?
> I have the machines set to email me periodic reports, which look like this:
>> RAID Status:
>> ============
>> Date:               Oct 13 2017 09:00:03 UTC
>> Status:             Clean
>> Array         Size          Mount         Level         RAID Status
>> -----------------------------------------------------------------------
>> /dev/md126    951214MB      /             RAID-1        Clean
>> /dev/md127    476MB         /boot         RAID-1        Clean

Your original post made no mention of mdadm, but did mention making
copies of things using rsync (which I now see you probably just used
to load data onto the filesystem).  So, I figured you were using
something improvised and not actual md-raid.

You're definitely using raid-1 here and my concerns do not apply.

> A related question:  For the purposes of backup I can deal with using two
> drives to exactly duplicate my setup (two identical physical drives, each
> with three partitions, 1 X 4 GB, 1 X 1 GB, 1 X (remainder of space), with
> the first being swap, the second being used to create /dev/md0 across the
> drives, as /boot, and the third being used to create /dev/md1 across the
> drives, as /.)

This is overkill for a backup, IMO.  You just need to back  up your
data - you don't need to do a bit-level replica of your RAID.
rsync/tar/etc are all perfectly sufficient.  The chances of you losing
all your backup media at the same time that you lose your RAID is very
small, assuming your backups are stored offsite.

> If you wanted to go from the two-drive configuration with mdadm partitions
> across them to a single-drive configuration (no raid), and do this by
> creating a copy (leaving the existing drives untouched), what's the best
> way?  I don't care whether I use a single physical hard drive first and then
> make an image of it, or go directly to an image.  Could I copy the contents
> of /dev/md0 and /dev/md1 to a /dev/sda1 and /dev/sda2 with rsync?  Would
> that eliminate the metadata associated with the mdadm partitions?  This is
> ClearOS 6 (a clone of CentOS 6), 64-bit.  I will be repeating the process
> with ClearOS/CentOS 7.  Links are fine.

Yes, that would work as long as you adjust your fstab/etc.  You could
probably also use a tool like partclone (probably offline) and do more
of a binary replica, which would probably preserve the UUID of the
filesystem itself, and thus allow fstab to be used as-is, but I've
never tested that.  If you're using labels instead of UUIDs then that
is probably also less fuss, but you'll need to create the labels when
you create your destination filesystems.

/dev/md0 are just block devices and work the same as drive partitions
as far as dd or mounting/rsyncing go.  That's the beauty of mdadm (and
lvm for that matter).

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --