OpenVZ Forum


Home » Mailing lists » Users » Cloning and permissions
Cloning and permissions [message #25195] Mon, 17 December 2007 12:40 Go to next message
Peter Machell is currently offline  Peter Machell
Messages: 5
Registered: December 2007
Junior Member
After cloning a Debian host, I found everything working except MySQL.

I had to chown its binaries, databases and log folder back to mysql  
from root.

Is this normal and should I expect other permissions to have changed?  
When copying the VZ does the ownership of files take on whatever  
matches the UID on the host system?

regards,
Peter.
Re: Cloning and permissions [message #25198 is a reply to message #25195] Mon, 17 December 2007 14:12 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Peter,

It depends on what you mean by "cloning". What exact command/operations
you did?

BTW, do you mean OpenVZ or Virtuozzo?

Thanks,
Kirill



Peter Machell wrote:
> After cloning a Debian host, I found everything working except MySQL.
> 
> I had to chown its binaries, databases and log folder back to mysql  
> from root.
> 
> Is this normal and should I expect other permissions to have changed?  
> When copying the VZ does the ownership of files take on whatever  
> matches the UID on the host system?
> 
> regards,
> Peter.
Re: Cloning and permissions [message #25203 is a reply to message #25198] Mon, 17 December 2007 14:51 Go to previous messageGo to next message
Jean-Michel Caricand is currently offline  Jean-Michel Caricand
Messages: 4
Registered: December 2007
Junior Member
Le lundi 17 décembre 2007 15:15, Kirill Korotaev a écrit :
> Peter,
>
> It depends on what you mean by "cloning". What exact command/operations
> you did?
>
> BTW, do you mean OpenVZ or Virtuozzo?
>
> Thanks,
> Kirill
>
> Peter Machell wrote:
> > After cloning a Debian host, I found everything working except MySQL.
> >
> > I had to chown its binaries, databases and log folder back to mysql
> > from root.
> >
> > Is this normal and should I expect other permissions to have changed?
> > When copying the VZ does the ownership of files take on whatever
> > matches the UID on the host system?
> >
> > regards,
> > Peter.
Hi Peter,

If you use rsync to copy your VE, you must add this option : --numeric-ids

Cheers.

-- 
Jean-Michel Caricand
Tél: 03.81.66.20.63
E-mail: jean-michel.caricand@lifc.univ-fcomte.fr

Equipe systèmes
Laboratoire d'Informatique de l'Université de Franche-Comté
16, route de Gray - 25030 BESANÇON CEDEX
Re: Cloning and permissions [message #25204 is a reply to message #25195] Mon, 17 December 2007 14:44 Go to previous messageGo to next message
Jean-Michel Caricand is currently offline  Jean-Michel Caricand
Messages: 4
Registered: December 2007
Junior Member
Le lundi 17 décembre 2007 13:40, Peter Machell a écrit :
> After cloning a Debian host, I found everything working except MySQL.
>
> I had to chown its binaries, databases and log folder back to mysql
> from root.
>
> Is this normal and should I expect other permissions to have changed?
> When copying the VZ does the ownership of files take on whatever
> matches the UID on the host system?
>
> regards,
> Peter.
Hi Peter,

If you use rsync to copy your VE, you must add this option : --numeric-ids

Cheers.

-- 
Jean-Michel Caricand
Tél: 03.81.66.20.63
E-mail: jean-michel.caricand@lifc.univ-fcomte.fr

Equipe systèmes
Laboratoire d'Informatique de l'Université de Franche-Comté
16, route de Gray - 25030 BESANÇON CEDEX
Re: Cloning and permissions [message #25210 is a reply to message #25198] Mon, 17 December 2007 22:50 Go to previous messageGo to next message
Peter Machell is currently offline  Peter Machell
Messages: 5
Registered: December 2007
Junior Member
On 18/12/2007, at 12:15 AM, Kirill Korotaev wrote:

> Peter,
>
> It depends on what you mean by "cloning". What exact command/ 
> operations
> you did?

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

> BTW, do you mean OpenVZ or Virtuozzo?

OpenVZ

regards,
Peter.
Re: Cloning and permissions [message #25212 is a reply to message #25210] Mon, 17 December 2007 23:16 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
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
Re: Cloning and permissions [message #25215 is a reply to message #25212] Tue, 18 December 2007 00:54 Go to previous messageGo to next message
Steve Wray is currently offline  Steve Wray
Messages: 18
Registered: August 2007
Junior Member
Gregor Mosheh wrote:
> 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 - )

That doesn't need a -p option? ie

  'tar xpvf'

I tend to use 'tar --numeric-owner -cf' as well, just in case.
Re: Cloning and permissions [message #25216 is a reply to message #25215] Tue, 18 December 2007 01:14 Go to previous messageGo to next message
Gregor Mosheh is currently offline  Gregor Mosheh
Messages: 62
Registered: April 2007
Member
Steve Wray wrote:
>> tar cf - * | ( cd ../2 ; tar xvf - )
> That doesn't need a -p option? ie
> I tend to use 'tar --numeric-owner -cf' as well, just in case.

I've never used the -p flag but it's always preserved the numerics just 
fine. That's Slackware and Fedora, probably others. Couldn't hurt to use 
it, though.

-- 
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
Re: Cloning and permissions [message #25226 is a reply to message #25210] Tue, 18 December 2007 07:14 Go to previous messageGo to next message
Jean-Michel Caricand is currently offline  Jean-Michel Caricand
Messages: 4
Registered: December 2007
Junior Member
Le lundi 17 décembre 2007 23:50, Peter Machell a écrit :
> On 18/12/2007, at 12:15 AM, Kirill Korotaev wrote:
> > Peter,
> >
> > It depends on what you mean by "cloning". What exact command/
> > operations
> > you did?
>
> 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
>
> > BTW, do you mean OpenVZ or Virtuozzo?
>
> OpenVZ
>
> regards,
> Peter.
Hi Peter,

I think rsync is the best solution to copy a VE :-) 

Example : 

# rsync -av -numeric-ids /vz/private/101 /vz/private/102 (on the same host)

See : 
http://forum.openvz.org/index.php?t=msg&goto=3164&

Cheers.

-- 
Jean-Michel Caricand
Tél: 03.81.66.20.63
E-mail: jean-michel.caricand@lifc.univ-fcomte.fr

Equipe systèmes
Laboratoire d'Informatique de l'Université de Franche-Comté
16, route de Gray - 25030 BESANÇON CEDEX
Re: Cloning and permissions [message #25261 is a reply to message #25226] Wed, 19 December 2007 10:13 Go to previous message
Peter Machell is currently offline  Peter Machell
Messages: 5
Registered: December 2007
Junior Member
On 18/12/2007, at 5:14 PM, Jean-Michel Caricand wrote:
>
> Hi Peter,
>
> I think rsync is the best solution to copy a VE :-)
>
> Example :
>
> # rsync -av -numeric-ids /vz/private/101 /vz/private/102 (on the  
> same host)


Thanks Jean-Michel that works a treat. You forgot a - though, for the  
record the right command (at least on Debian) is:

# rsync -av --numeric-ids /vz/private/101 /vz/private/102

regards,
Peter.
Previous Topic: VE fails to stop
Next Topic: ALERT! /dev/mapper/ubuntu-root does not exist
Goto Forum:
  


Current Time: Tue Mar 19 05:29:07 GMT 2024

Total time taken to generate the page: 0.02438 seconds