[CentOS] Clone a custom CentOS 7 desktop using G4L over FTP

Mon May 28 10:47:44 UTC 2018
Nux! <nux at li.nux.ro>


If that G4L is anything like dd then the UUIDs should have been preserved and GRUB should have worked.
If that didn't work then G4L is doing its own thing.

What you could do is perhaps set some LABELs in the original install on the partitions (see tune2fs), set GRUB and /etc/fstab to reference them, then if possible tell G4L to set those labels on the partitions after restore. You could of course keep using UUIDs, but that would be messier, LABELs are more human friendly.

You can also go back to using /dev/sdX, just as with LABELs above, but that can break under certain conditions and it's no longer recommended.

To obtain unique installations from a template you should at least:
- as you mentioned nuke the udev persistent rules
- delete the ssh keys in /etc/ssh (they will be regenerated)
- remove /var/lib/systemd/random-seed (affects system entropy, important for crypto, it gets regenerated)
- remove HWADDR and UUID entries from ifcfg files
- remove log files from /var/log 
- do a "yum clean all"
- remove bash history
- remove leftover install files from /root (log and cfg)
- maybe relabel the filesystem with Selinux (touch /.autorelabel before powering off template)

There could be more you can do. Much of this can be put in a kickstart file actually and use that with PXE and a local mirror instead of G4L.. :-)
I do that for my cloud templates, e.g. http://dl.openvm.eu/cloudstack/config/centos/centos7-kvm.cfg


Sent from the Delta quadrant using Borg technology!


----- Original Message -----
> From: "Nicolas Kovacs" <info at microlinux.fr>
> To: "CentOS mailing list" <centos at centos.org>
> Cc: "Jean Mortreux" <jean.mortreux at scholae.fr>
> Sent: Friday, 25 May, 2018 05:45:04
> Subject: [CentOS] Clone a custom CentOS 7 desktop using G4L over FTP

> Hi,
> A couple months ago, I migrated our local school (two servers, 20
> desktop clients) from Slackware 14.1 to CentOS 7. The desktop clients
> are running a customized lightweight desktop based on Xfce:
> https://blog.microlinux.fr/poste-de-travail-xfce-centos-7/
> Home directories are all on the server, and authentication is
> centralized. Everything works fine so far.
> With Slackware I had found a neat trick to install the desktop clients.
> First I installed and configured one single client PC from start to
> finish. The I zeroed all the unused sectors on the disk, using something
> like this:
>  # dd if=/dev/zero of=/0bits bs=20M ; rm -f /0bits
> Then I sent the disk image to a local FTP server using G4L (Ghost4Linux).
> On all the other desktops PCs, I could then "import" the G4L image, and
> the system was ready to use.
> Under Slackware, the only thing I had to make sure was to remove the one
> bit of hardcoded system information before uploading the image:
>  # rm /etc/udev/rules.d/70-persistent-net.rules
> Now I tried to do this with CentOS, but I failed miserably. The system
> wouldn't even start, since GRUB uses UUIDs and not /dev/sdX like
> Slackware's bone-headed LILO boot manager.
> So here's my question to the guru admins on this list. On a standard
> CentOS desktop, what would I have to tweak in order to be able to clone
> my system bit for bit, as is ?
> Cheers,
> Niki
> --
> Microlinux - Solutions informatiques durables
> 7, place de l'église - 30730 Montpezat
> Site : https://www.microlinux.fr
> Blog : https://blog.microlinux.fr
> Mail : info at microlinux.fr
> Tél. : 04 66 63 10 32
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos