Moving /var/cfengine

33 views
Skip to first unread message

Beto

unread,
Feb 7, 2025, 9:25:35 AMFeb 7
to help-cfengine
I need to move an Enterprise hub to new storage on the same server.  I'm thinking of using rsync for this:

rsync -avz /var/cfengine /var/new_cfengine

Of course everything would first be shut down.

Has anyone tried this?  I have a low pain tolerance lol.

craig.c...@northern.tech

unread,
Feb 25, 2025, 8:57:13 AMFeb 25
to help-cfengine
Hello!

Sorry this one hasn't had any responses. Did you figure something out?

This /var/cfengine path is hard-coded into CFEngine at compile time. It is referred to as WORKDIR:


If you need to migrate to new storage I might suggest this untested procedure:

- shut CFEngine down with something like `systemctl stop cfengine3`
- double-checking that all CFEngine related processes are not running with something like `ps -efl | grep cf`
- moving the current directory aside: `mv /var/cfengine /var/old-cfengine`
- mounting your new storage as `/var/cfengine`
- using rsync to copy everything over: `rsync -avz /var/old-cfengine/ /var/cfengine/`
- restart services with `systemctl start cfengine3`

I haven't had occasion to perform such a migration so take this as a suggested course to be considered carefully as you plan.

Let us know how it goes or if you have more questions.

-Craig

Beto

unread,
Feb 27, 2025, 9:41:30 AMFeb 27
to help-cfengine
Hi Craig,

That's pretty much the process I was thinking of using.  I haven't tried it yet as other priorities have taken over.  I'll post results once I get to try it.

Thanks for replying!

Nick Anderson

unread,
Feb 27, 2025, 3:17:39 PMFeb 27
to help-cfengine
Weird, I have some memory of answering similar within the past few weeks. Maybe my flesh brain is breaking down.

selinux contexts might not be handled with that but that's the only thing that jumps to mind.

Vratislav Podzimek

unread,
Feb 27, 2025, 5:06:26 PMFeb 27
to help-c...@googlegroups.com
On Thu, 2025-02-27 at 12:17 -0800, 'Nick Anderson' via help-cfengine wrote:
> Weird, I have some memory of answering similar within the past few weeks. Maybe my flesh brain is breaking down.
>
> selinux contexts might not be handled with that but that's the only thing that jumps to mind.
Yes, SELinux contexts and ACLs. Check man:rsync(1) for options to use, `-a`
alone won't be enough.

--
Vratislav

>
> On Thursday, February 27, 2025 at 8:41:30 AM UTC-6 Beto wrote:
> > Hi Craig,
> >
> > That's pretty much the process I was thinking of using.  I haven't tried it yet as other priorities have taken over.  I'll post results once I get to try it.
> >
> > Thanks for replying!
> >
> > On Tuesday, February 25, 2025 at 7:57:13 AM UTC-6 craig.c...@northern.tech wrote:
> > > Hello!
> > >
> > > Sorry this one hasn't had any responses. Did you figure something out?
> > >
> > > This /var/cfengine path is hard-coded into CFEngine at compile time. It is referred to as WORKDIR:
> > >
> > > https://docs.cfengine.com/docs/3.24/reference-special-variables-sys.html#sys-workdir
> > >
> > > If you need to migrate to new storage I might suggest this untested procedure:
> > >
> > > - shut CFEngine down with something like `systemctl stop cfengine3`
> > > - double-checking that all CFEngine related processes are not running with something like `ps -efl | grep cf`
> > > - moving the current directory aside: `mv /var/cfengine /var/old-cfengine`
> > > - mounting your new storage as `/var/cfengine`
> > > - using rsync to copy everything over: `rsync -avz /var/old-cfengine/ /var/cfengine/`
> > > - restart services with `systemctl start cfengine3`
> > >
> > > I haven't had occasion to perform such a migration so take this as a suggested course to be considered carefully as you plan.
> > >
> > > Let us know how it goes or if you have more questions.
> > >
> > > -Craig
> > > On Friday, February 7, 2025 at 8:25:35 AM UTC-6 Beto wrote:
> > > > I need to move an Enterprise hub to new storage on the same server.  I'm thinking of using rsync for this:
> > > >
> > > > rsync -avz /var/cfengine /var/new_cfengine
> > > >
> > > > Of course everything would first be shut down.
> > > >
> > > > Has anyone tried this?  I have a low pain tolerance lol.
> --
> You received this message because you are subscribed to the Google Groups "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/help-cfengine/bdcbbef4-1df8-4ac2-8078-4eacb71522a6n%40googlegroups.com.

Message has been deleted
Message has been deleted

Beto

unread,
Mar 3, 2025, 1:55:48 PMMar 3
to help-cfengine
Welp, /var/cfengine ran out of space so I had to bite the bullet.  This is what I used:

rsync -X -avz --delete /var/cfengine/ /var/new_cfengine/

I then checked SELinux contexts in /var/new_cfengine and they were preserved, which was interesting as there is a lot of scary stuff on the interweb tubes about rsync and SELinux.  This hub is on RHEL8 7.9.

So far no SELinux AVCs and everything seems to be running fine.

Vratislav Podzimek

unread,
Mar 4, 2025, 7:28:37 AMMar 4
to help-c...@googlegroups.com
On Mon, 2025-03-03 at 10:13 -0800, Beto wrote:
> Welp, /var/cfengine ran out of space so I had to bite the bullet.  This is what I used:
>
> rsync -X -avz --delete /var/cfengine/ /var/new_cfengine/
>
> I then checked SELinux contexts in /var/new_cfengine and they were preserved, which was interesting as there is a lot of scary stuff on the interweb tubes about rsync and SELinux.  This hub is on RHEL8 7.9.
>
> So far no SELinux AVCs and everything seems to be running fine.
Great! 🎉️
> To view this discussion visit https://groups.google.com/d/msgid/help-cfengine/7c480f9d-f316-49d1-8036-841952c41b6dn%40googlegroups.com.

Beto

unread,
Mar 4, 2025, 6:07:03 PMMar 4
to help-cfengine

Welp, /var/cfengine ran out of space so I had to bite the bullet.  This is what I used:

 rsync -X -avz --delete /var/cfengine/ /var/new_cfengine/

 I then checked SELinux context in /var/new_cfengine and they were all intact.  This was a bit surprising considering all the scary stuff on the interweb tubes around rsync and SELinux.  This hub is on RHEL8 7.9.

 So far no SELinux AVCs and everything appears to be running fine.


On Thursday, February 27, 2025 at 4:06:26 PM UTC-6 vratislav...@northern.tech wrote:
Reply all
Reply to author
Forward
0 new messages