Rocky Linux 10 Tutorial / Restore snapshots and isolate a full VM clone
A VirtualBox snapshot is a restoration point that returns the same virtual machine (VM) to a specific point in time, whereas full cloning is the process of creating a separate VM. Before restoring, first check the changes that will be lost, and verify the clone while isolated so its name, address, and identification information do not overlap with the original.
Distinguish the purposes of snapshots, full cloning, and backup
Snapshots are useful when you want to set a point to revert to, just before trying a new configuration. However, if they rely on the disk and VM files of the same host, they cannot serve as a separate backup against host storage failure. Conversely, full cloning creates a VM that runs separately from the original, but accounts, host keys, and names inside the cloned guest are not automatically adjusted for the new server.
| Method | Main Purpose | Limitations to Check |
|---|---|---|
| Snapshot | Restore the settings and virtual disk state of the same VM to a specific point in time | Subsequent changes may disappear upon restoration, and it depends on the original and differential disk files |
| Full Clone | Create an independent experimental VM with separate disks | Guest OS name, address, key, account, etc., may be copied |
| Separate Backup | Restore the necessary data and configuration in case of failure, error, or data loss | Preparation must include a different storage location, recovery procedure, and actual restoration test |
Linked Clone uses differential disks that depend on the snapshots and disks of the original. This article uses a full clone to make disk independence easier to inspect. Do not break differencing-disk chains by deleting original VM files manually.
First, record the range to be restored and the practice marker.
The source lab used the dedicated LF-Rocky10-Lab-20261112 VM after verifying SSH public-key login. A universally unique identifier (UUID) distinguishes the VM from other registered machines. Compare the VM name, UUID and virtual disk path on the host before restoring. The examples below use Rocky10-Lab, the name from the VM creation lesson; substitute your actual lab VM name if different. Never apply these restoration commands to a production VM.
The system disk in this exercise is in normal mode and included in the snapshot. Do not assume that additional data disks, shared folders or external databases will be rolled back with this system disk. Check each storage resource separately before restoring. If there is important external data, you should separately check whether the snapshot for that storage method is included and make a backup.
Create a new marker file in the Rocky Linux regular user shell. If there is an existing file with the same name, do not overwrite it; use a different practice name.
test ! -e ~/snapshot-lab-note.txt && printf 'before-snapshot\n' > ~/snapshot-lab-note.txt
cat ~/snapshot-lab-note.txt
hostnamectl --static
uname -r
The marker was before-snapshot, and the name of this VM was rocky10-lab. Record this value along with the purpose of taking the snapshot. For servers where database or file recording operations are running, it is also necessary to follow the application consistency procedure. This exercise simply checks files and settings and then shuts down the guest normally.
sudo systemctl poweroff
Create a baseline snapshot while the VM is in a normal shutdown state.
In VirtualBox Manager, check that the VM is Powered Off and open the Snapshots screen for that VM. In Current State, select Take and enter a name and description. The name for this exercise is lf-course-baseline-20261112. The installation, update, and SSH verification have been completed, and the description left is "before-snapshot."
You can also perform the same task in Windows PowerShell. The blocks below are an example of sequential execution in the same PowerShell window. If you opened a new window, reassign the variables. The $VBox below is the path to VirtualBox executable on the host, and the commands are not run inside the Rocky guest.
$VBox = 'C:/Program Files/Oracle/VirtualBox/VBoxManage.exe'
$VM = 'Rocky10-Lab'
$Snapshot = 'lf-course-baseline-20261112'
& $VBox showvminfo $VM --machinereadable
& $VBox snapshot $VM list --machinereadable
& $VBox snapshot $VM take $Snapshot --description 'Updated Rocky 10.2, SSH verified, before-snapshot marker'
& $VBox snapshot $VM list --machinereadable
Check the VM name, UUID, proper shutdown state, and duplicate snapshot names first, then execute the take command. If the same snapshot has already been created, it will not be recreated just because it's a new run. VirtualBox 7.2's VM and snapshot guide differentiates between how settings and virtual disk states are included in snapshots and the memory state of snapshots taken while running.
After creating a snapshot, writes to the current state may accumulate in differential images. Do not just confirm that the name appears; also check the relationship between the reference point in the list and Current State, as well as the host disk space. Do not move or delete differential disk files in the VM folder arbitrarily through the explorer.
Create changes for practice and compare the restoration results.
Boot the VM and wait to see if you can log in. The fact that the start command succeeded does not mean that SSH and all services are ready. Proceed to the next practice after checking the boot progress in the console and confirming actual login and access.
printf 'after-snapshot\n' > ~/snapshot-lab-note.txt
sudo hostnamectl hostname rocky10-restore-test
cat ~/snapshot-lab-note.txt
hostnamectl --static
sudo systemctl poweroff
At this time, the marker is after-snapshot, and the name is rocky10-restore-test. Check whether these two changes can be discarded and verify proper shutdown again in VirtualBox. If you need to preserve the current state, first take a separate snapshot or back up the necessary files.
& $VBox showvminfo $VM --machinereadable
& $VBox snapshot $VM restore $Snapshot
& $VBox startvm $VM --type headless
In the GUI, select the base snapshot and use Restore. This action is different from Delete, which removes a snapshot. Restoration can discard subsequent disk changes, but deletion does not revert the current state to a past point.
After logging in again, check the marker, name, kernel, and necessary SSH and sudo operations.
cat ~/snapshot-lab-note.txt
hostnamectl --static
uname -r
systemctl is-active sshd
sudo -v
In this practice, after restoration, before-snapshot and rocky10-lab were displayed again, and the base kernel 6.12.0-211.74.1.el10_2.x86_64 and running SSH were confirmed. Restoration discarded the after-snapshot marker and the temporary hostname introduced after the baseline.
If restoration succeeded, the marker and name should return to the values of the checkpoint. Kernel updates or SSH settings that were completed before creating the snapshot are included in the checkpoint, so check to see if those states are maintained as well.
Start the full clone with a new MAC·UUID and an isolated network.
After shutting down the original properly, make sure the experience level in VirtualBox Manager is set to Expert, then right-click on the target VM in the Machines list, select Clone, and specify a new name and storage location. Keep the MAC Address Policy set to generate a new MAC address for all adapters, and do not select Keep Hardware UUIDs. Select Full Clone and Current Machine State to copy the current state of the original to a separate VM.
The name for this clone is Rocky10-Clone. If the same name or target folder already exists, check the existing results first. Do not create duplicate VMs by cloning the original again. You can also refer to VBoxManage official reference to check default MAC·UUID regeneration and full/linked clone options.
$Clone = 'Rocky10-Clone'
$CloneBase = Join-Path $env:USERPROFILE 'VirtualBox-Labs'
$CloneDir = Join-Path $CloneBase $Clone
if (Test-Path -LiteralPath $CloneDir) { throw 'The clone destination folder already exists.' }
if (& $VBox list vms | Select-String -SimpleMatch ('"' + $Clone + '"')) { throw 'A VM with this name already exists.' }
& $VBox clonevm $VM --name $Clone --basefolder $CloneBase --mode machine --register
& $VBox showvminfo $Clone --machinereadable
& $VBox modifyvm $Clone --nic1 none
A media access control (MAC) address identifies a virtual network adapter. Generating new MAC addresses is separate from changing the guest’s name, IP configuration and machine-id. Before first boot, verify that the adapter is set to none. This example assumes one adapter; disconnect every enabled adapter if your VM has more. If the localhost port forwarding rules from the original were also copied, they should be removed from the clone or assigned to separate ports planned for later use. Leave the original rules as they are. Creating a new MAC address does not mean you can immediately connect the same fixed IP and server name from the original to the network.
Full cloning is a copy intended to run independently from the original disk, whereas linked cloning depends on the differential image linked to the original. After distinguishing between the two, determine whether the original can be cleaned up. Even when keeping a clone for backup purposes, there are limitations to storing it on the same physical disk.
The source lab performed this procedure using VirtualBox 7.2.10 on a Windows host and Rocky Linux 10.2 as a guest. The clone had a VM UUID and MAC address different from the original, and the Parent UUID: base of the cloned VDI was verified. The port forwarding rules of the clone were removed, and the adapter was set to none before the first boot. Boot with the GUI or open the Show screen of the running VM to log in via the console.
Check for duplicate information and access credentials inside the clone.
Log in to the clone via the console with the network isolated. The new name in the VM list and the hostname inside the guest are separate. Compare the following items with the original.
| Items | Items to Classify and Verify |
|---|---|
| VirtualBox VM UUID·MAC | Check on the host whether new values were generated in the clone options |
| Guest host name | Check with hostnamectl --static and assign a new name according to the role of the clone |
| IP and Dynamic Host Configuration Protocol (DHCP) settings | Check whether the original static address, connection profile, and reservation policy are duplicated |
| machine-id | Check whether the OS identifier was copied as is and initialize a new value according to the deployment method |
| SSH host key | Prepare new keys and fingerprints so that the clone does not operate as the original server identity |
| Accounts·authorized_keys·data·credentials | Review whether it is okay to include in the clone, and check for unnecessary access rights, secrets, or logs remaining |
hostnamectl --static
ip -br address
sha256sum /etc/machine-id
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
The machine-id is a value that identifies the system, so the original string is not exposed as-is in public posts or external services. This local practice checks for duplication by comparing whether the file hash is the same. The explanation of systemd's machine-id states that each instance requires a unique value, and the creation time varies depending on the initialization state of the new image.
A production general-purpose image requires preparation according to the systemd image preparation instructions , including random seeds, credentials and boot identifiers. It is not generalized by simply changing one name or applying a delete command from the internet to the original server. This post is limited to verification on a dedicated clone VM without production data.
Separate the identification information of the clone and check it by rebooting.
The clone for this practice is a minimal server without production data, and the network adapter was kept as none. First, confirm in VirtualBox whether the console is of the original or a different clone, and record the Desktop Management Interface (DMI) UUID reported by sudo cat /sys/class/dmi/id/product_uuid on that guest. Enter the actual value of that clone in ExpectedCloneDmiUuid in the script below. If the guidance string is left as-is, it will stop before making changes.
In the general user's home of the clone, run cat > ~/clone-identity.sh, paste the entire script below, and save it with Ctrl+D. After reviewing the content, execute it with bash ~/clone-identity.sh. This is not an initialization script for the original or production server, and this procedure should not be generalized for servers that already contain existing data or encrypted service credentials.
set -eu
ExpectedCloneDmiUuid='REPLACE-WITH-THE-CLONE-DMI-UUID'
ActualDmiUuid=$(sudo cat /sys/class/dmi/id/product_uuid)
if [ "$ActualDmiUuid" != "$ExpectedCloneDmiUuid" ]; then
printf 'The clone identifier does not match. No changes were made.\n'
exit 1
fi
sudo hostnamectl hostname rocky10-clone
sudo systemctl stop sshd
for kind in rsa ecdsa ed25519; do
sudo rm -f -- "/etc/ssh/ssh_host_${kind}_key" "/etc/ssh/ssh_host_${kind}_key.pub"
done
sudo ssh-keygen -A
sudo restorecon /etc/ssh/ssh_host_*key*
sudo systemctl stop systemd-random-seed.service
sudo rm -f -- /var/lib/systemd/random-seed
sudo truncate -s 0 /etc/machine-id
if test -f /var/lib/dbus/machine-id && ! test -L /var/lib/dbus/machine-id; then
sudo truncate -s 0 /var/lib/dbus/machine-id
fi
sudo systemctl reboot
ssh-keygen -A generates missing default SSH host keys. The above procedure deletes only the three types of default keys in the clone and creates new keys, It does not regenerate or remove user public keys in authorized_keys. When reconnecting, separately verify the fingerprint of the new host key for the clone.
Running processes may already be using machine-id. Do not merely edit the file and continue operating services as though their identity had changed. This procedure empties the file and immediately reboots so that a new value can be generated upon reboot. It also checks if /var/lib/dbus/machine-id is a separate regular file, and if the actual image or provisioning method of the system is different, review the initialization steps again. This minimal installation did not have that separate D-Bus file.
For general image preparation, reuse of random seeds should also be considered. In the above exercise, the replicated seed file is removed after the seed service shutdown process is completed. For production images, encrypted credentials, agent registration, and service-specific identifiers must all be handled according to the procedures of the deployment tool, so we do not consider the universal template complete with just these few changes.
After rebooting, log in again to the replicated console and compare the name, machine-id hash, and host key fingerprint with the original. The network is kept isolated for now.
hostnamectl --static
wc -c /etc/machine-id
sha256sum /etc/machine-id
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
ip -br address
A normal machine-id file may include a 32-digit hexadecimal value and a newline, and this exercise checks whether a hash different from the original was generated. Only confirming the new name is not sufficient; the process is not completed while leaving duplicate SSH host keys or OS identifiers unchanged.
In the source lab, immediately after cloning, the clone’s machine-id hash and SSH host key matched the original. After the aforementioned initialization and reboot, rocky10-clone shows the new machine-id file of 33 bytes with a hash different from the original and a new ED25519 host key fingerprint. Only the loopback interface was shown on the network of the replica, SSH service was active, SELinux was Enforcing, and sudo worked for a normal administrator account. When checking the original separately, rocky10-lab shows the original machine-id hash, SSH fingerprint, and the before-snapshot mark remained unchanged.
Verify restoration, disk independence and unique identity
Check whether the marks and names of the restored original have returned to their reference points, and whether the existing management paths are intact. The replica exists on a new VM or disk, and before connecting to the network, you should review the identification information and access credentials. Do not substitute these checks with just the snapshot name or the replication success message.




