[clug] Moving the contents of / to a new filesystem on Ubuntu?

Amitay Isaacs amitay at gmail.com
Mon Jul 26 18:47:08 MDT 2010


On Tue, Jul 27, 2010 at 10:26 AM, Ben Nizette <bn at niasdigital.com> wrote:

>
> On 27/07/2010, at 9:48 AM, Ben Nizette wrote:
>
> >
> > On 27/07/2010, at 6:58 AM, Craig Small wrote:
> >
> >> cd /
> >> tar cf - . | ( cd /newdir ; tar xf - )
> >>
> >> I've used that a lot, especially when drives didn't used to be that
> >> good.  Make the second tar xvf if you want to see what is going on.
> >>
> >
> > I used to use that too but I couldn't work out what it does that cp -a or
> rsync -aHAX don't (in fact I think rsync -aHAX might even do a more complete
> job of preservation than tar).  Anyone know the differences?
>
> OK of course there's a brazillion differences, rather "anyone know why I'd
> use the twin-tar version over the others?"
>
> Thx :)
>         --Ben.
>
>
I have often seen the speed of copying with "cp -a" is much lower than tar
or rsync.
Another option one can consider is cpio.

find / -print | cpio -pdm /newdir

Only issue with cpio is there is no option to preserve the selinux context
after copying. The other
command have options that preserve the context.

cp -p all (implicit with -a)
rsync -X
tar (copies context by default)

Amitay.


More information about the linux mailing list