Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2904  / 1 Year ago, wed, december 28, 2022, 4:52:23

I have ordered several virtual machines from a hosting provider, which all need exactly the same setup:




  • same users

  • same programs installed

  • same config (except for hostname) including cron-jobs



Is it possible and save to create a tarball of my entire system, excluding /dev, /proc, /sys folders and the /etc/hostname file and just unpack it on the disk while the system is not running (using a repair mode, or a Live CD, in case of a physical server)?



What else do I have to consider?



Edit: Since I have no physical access to these machines, everything has to be done from the command line.



Edit 2: Also /etc/network/interfaces should not be copied.


More From » 10.04

 Answers
6

Yes, you can.




  1. Make sure the /etc/fstab is still correct, based on where you put partitions and what types they are. Make sure you run mkswap on any swap partition. If UUIDs are used, then you'll need to update these. The blkid command will give you the UUIDs of all the new partitions. If labels are used, then use the e2label command (or equivalent command for your filesystem) to make sure that the labels match.


  2. Skip these, and make sure you create empty ones at the other end: /run (/var/run on older releases), /proc, /sys, /dev. Check /proc/mounts on the old (running) system for others (there are fewer on newer releases).


  3. Update /etc/hostname and /etc/hosts (which also contains the hostname).


  4. Check /etc/udev/rules.d/ for a 70-persistent-net.rules or similarly named file that contains any NIC MAC addresses. These are usually skipped for virtual machines though, and the only harm would be that you end up with an eth1 device instead of the usual eth0.


  5. As you've mentioned, you should check /etc/network/interfaces for correctness, especially with respect to ethernet device names.


  6. Re-run the bootloader installation. This is the awkward bit. It depends on how your VPS provider boots your instance. It's worth having a plan for this before you begin.



[#32950] Thursday, December 29, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tialmes

Total Points: 14
Total Questions: 108
Total Answers: 102

Location: Oman
Member since Thu, Jun 16, 2022
2 Years ago
;