[Users] Cloning and permissions

Gregor Mosheh gregor at hostgis.com
Mon Dec 17 18:16:40 EST 2007


Peter Machell wrote:
> vzctl stop xx
> cp -R /vz/private/xx /vz/private/xxx
> cp -R /etc/vz/conf/xx.conf /etc/vz/conf/xxx.conf
> vzctl start xxx

To have cp preserve permissions, use the -p flag.

I use tar instead of cp, for situation like this. Tar, unlike cp, is 
smart enough to handle symbolic links, permissions, ownerships, and 
sparse files. Use this age-old Unix Jedi trick:

mkdir /home/vz/private/2
cd /home/vz/private/1
tar cf - * | ( cd ../2 ; tar xvf - )

-- 
Gregor Mosheh / Greg Allensworth
System Administrator, HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA


More information about the Users mailing list