Linux Foundations / Start Here

Verify the guest and recover its clean state

Lesson 3 of 37. Open to read. No account needed.

A VM window that opens is a useful beginning. Before changing users, packages or services, you also need evidence that this is the intended guest and that you can return it to a known state. This lesson establishes both. You will inspect the running guest, save its clean disk while the VM is shut off, make one harmless guest change, and recover the saved state.

The recovery replaces the contents of this VM's disk. It discards every guest change made after the clean copy, including files, package changes and account changes. The marker makes that effect easy to observe; recovery does not selectively remove just the marker. Complete this exercise before keeping any valuable work in the guest. Keep your verification notes on the host.

What you will establish

By the end, you should be able to explain why the guest fits this course, show that its required tools and local help are available, and demonstrate recovery of the same course-owned guest. You will distinguish the chosen platform from evidence actually observed on your own machine.

The prerequisite is Prepare the practice VM. Use its Ubuntu Desktop 24.04 amd64 host, local libvirt system connection and the dedicated Ubuntu Server 24.04 amd64 VM named vecta-lab-linux. The guest must use the ordinary account created during installation. Host and guest administrator permission is used only in the explicitly labelled setup and disk-copy steps below.

Keep the host terminal and the guest console visibly separate. A prompt is the shell's invitation to type, not proof of which computer you are using. Commands below omit the prompt: type the command, press Enter, and read its output before continuing. Example output is labelled illustrative; your usernames, versions, UUIDs, disk sizes and free-space values will differ.

A clean copy is a point in time

Think of the clean disk as the contents of a workbook at a particular moment. Writing a new page in the active workbook does not update the saved copy. Restoring the saved copy returns the whole workbook to that earlier moment. Saving the workbook while someone is still changing it makes the boundary unclear. Our selected VM procedure therefore requires an orderly shutdown and an observed shut off state before either copying or restoring the disk.

The same course guest is checked and shut off before its disk and inactive XML are saved. After a guest marker is created, the guest is shut off again and the clean disk copy returns to that same disk. Booting the restored guest removes the later marker; the XML remains an identity record.

Read the arrows in order. The saved disk stays separate from the changing guest disk. The return arrow means restoring that same identified disk while stopped. The XML records the VM's identity and configuration; it is not another disk and is not imported as a second VM. The independent task repeats the marker test.

This is a bounded course-environment reset, not a general backup design. BIOS firmware and a single standalone qcow2 disk keep the state we must recover explicit. A paused VM, a managed save of memory, snapshots, a disk backing chain, UEFI variable storage or a virtual TPM would add state that this procedure does not recover.

Predict before proceeding: if a marker is created before making the clean copy, should restoring that copy remove it? Keep your answer for the checks near the end.

1. Guest: verify the system and account

Open the local console of vecta-lab-linux in virt-manager and sign in using your ordinary guest account. These first checks read information:

Command or argumentMeaning in this check
cat /etc/os-releaseDisplay the guest's operating-system identification file. Inspect ID and VERSION_ID.
uname -mPrint the machine architecture. The course's amd64 route reports x86_64.
id -u / id -unPrint your numeric user ID / username. A numeric ID of 0 is root and does not meet the learner-account requirement.
bashStart an interactive Bash shell for the commands that follow. A new prompt may look unchanged.
bash --versionDisplay the installed Bash version and return to the prompt.
ls --versionDisplay the GNU coreutils version used by this ls; it does not list files.
ps -p 1 -o comm=Ask the process-inspection tool for process ID 1's command name, suppressing the column heading. PID 1 is the initial process in this guest's process namespace.
ps -p $ -o comm=Inspect the current shell process. Bash replaces its special parameter $ with its own process ID before running ps; this narrowly scoped expansion is used only to verify the active shell here.
df -h /Report the filesystem containing /, using readable size units. Avail is available space; the virtual disk's nominal size is not its free space.

Run the identity checks first. Stop if the OS, architecture or account is wrong; do not try to turn a host or root shell into the course guest with these steps.

cat /etc/os-release
uname -m
id -u
id -un

You need ID=ubuntu, VERSION_ID="24.04", x86_64, and a nonzero user ID. Then start the intended shell and inspect the remaining facts:

bash
bash --version
ps -p $ -o comm=
ls --version
ps -p 1 -o comm=
df -h /

The current shell's command name should be bash; the version families should be Bash 5.2 and GNU coreutils 9.4. The PID 1 result should be systemd. Record the complete actual version lines and available space; do not replace them with these examples. A missing ps is a missing tool to resolve below, not evidence that PID 1 is correct.

Illustrative observations might be 1000 for the user ID and systemd for the PID 1 command. Either observation alone is insufficient: a nonroot account could be on the wrong machine, and some other environments can also run systemd. Combine them with the OS, architecture and named VM evidence.

The course's 2-vCPU, 4-GiB RAM and 25-GiB virtual disk are planning allocations, not measured minima or free-space guarantees. Check the allocated values in virt-manager's hardware details. Record the guest filesystem's actual free space now and after package setup. If it is nearly full or cannot cover a proposed installation with room left for practice, stop and resolve capacity on this disposable VM; do not delete unfamiliar system files.

2. Guest: establish package and manual readiness

The standard server installation supplies a useful starting set, but checking it is more dependable than assuming every editor or manual is present. dpkg-query reads the package database. -W requests records for the named packages. -f chooses the output fields: the single quotes pass the following format literally, so ${Package}, ${Status} and ${Version} are interpreted by dpkg-query, not expanded as shell variables. \n asks that formatter to end each record with a new line. This is a narrow setup bridge; package-state decisions receive their own lessons later.

dpkg-query -W -f='${Package}: ${Status}; ${Version}\n' bash coreutils man-db manpages nano less grep findutils sudo adduser passwd procps util-linux tar gzip apt dpkg systemd iproute2 libc-bin iputils-ping

For every listed name, find install ok installed. A version or a partly configured package record is not a substitute for that status. The systemd package should be from the Ubuntu 24.04 255 family. These packages cover the following course dependencies; you are checking availability, not learning all their commands at once.

Dependency groupPackages checked
Shell, ordinary files and textbash, coreutils, grep, findutils
Manuals, editor and pagerman-db, manpages, nano, less
Identity and explicitly privileged taskssudo, adduser, passwd
Process and storage inspectionprocps, util-linux
Archives, packages and servicestar, gzip, apt, dpkg, systemd
Later network inspectioniproute2, libc-bin, iputils-ping

For missing optional tools, the following bridge applies only inside this guest. sudo requests the authority for this one command; type your guest password privately if asked. Its input normally has no visible characters. apt update refreshes package indexes using the configured repositories; it does not itself install all available upgrades. It contacts those repositories. Do not continue past repository, signature or network errors.

sudo apt update

Use apt install only for package names the check found missing. For example, only if nano, less and man-db are the missing packages, the following installs them and their required dependencies. This is an example selection, not a blanket instruction to reinstall the inventory.

sudo apt install nano less man-db

Read the proposed changes and disk-space requirement before agreeing. Decline an unexpected removal or unrelated change and investigate it. If your missing set differs, replace the three example names with just those missing names from the table. If core packages are broken, sudo is unavailable, or the proposal does not make sense, return to the declared standard-installation setup or get help from the authorized machine owner. Do not log in as root as a workaround. Rerun the package query and space check after any accepted setup change.

man -w locates installed manual pages without opening a reader. Each named page should produce a path, with no missing-page error. These names are help topics; this command does not run the tools themselves.

man -w bash cp nano less grep find id ps lsblk findmnt tar gzip apt dpkg-query systemctl journalctl ip ss getent ping

For one actual help check, man bash opens the Bash manual in its reader. Use Space to move forward, b to move back and q to leave the reader. Do not type another shell command until the shell prompt returns.

man bash

Also check the future practice package without installing it. cat displays Ubuntu 24.04's repository configuration. apt-cache policy tree reads the locally cached package indexes and shows an installed version, candidate version and their repository origins; it does not contact repositories, refresh indexes, install or remove tree. Complete the already explained sudo apt update successfully before this check, even when no prerequisite packages were missing. A stale cache is not current candidate-readiness evidence.

cat /etc/apt/sources.list.d/ubuntu.sources
apt-cache policy tree

The configured official Ubuntu sources should include the universe component and a Noble tree candidate. Compare the origins with the official Ubuntu mirror chosen at installation; a candidate from an unexpected third party does not satisfy this check. Do not add a random repository to make the query work. If a component or candidate is missing, stop and reconcile the official setup.

Record the initial Installed value. If it is (none), leave it absent: a later lesson uses this clean starting state for an install/remove transaction. If tree is already installed, preserve it. Observation of that existing package will not demonstrate installation/removal; the later transaction requires a separate clean owned VM or checkpoint where it was absent. Do not remove a pre-existing package to manufacture that condition.

3. Guest: prepare an empty recovery fixture

~ at the beginning of an unquoted path means your home directory. mkdir -p creates the practice parent if necessary and accepts an existing parent. The second mkdir, without -p, deliberately refuses an existing exercise name. cd changes the current directory; pwd displays it; ls -a shows its entries, including . for this directory and .. for its parent.

mkdir -p ~/linux-practice
mkdir ~/linux-practice/verify-and-reset-the-guest
cd ~/linux-practice/verify-and-reset-the-guest
pwd
ls -a

Continue only in this ordinary account's exercise directory and only when it contains . and ... Do not create the marker yet. If the exercise name already exists, stop creating it and follow the resume section below; do not erase it to make the command appear successful.

Your baseline now includes the checked packages and this empty directory. Record the guest observations on the host, where restoring the guest cannot erase them.

4. Host: stop and identify the complete owned state

Return to the host terminal from the VM setup lesson. id -u must again be nonzero. Every virsh command uses -c qemu:///system to select the same local system connection. The domain name after the command is exactly the owned vecta-lab-linux, not another VM selected by convenience.

shutdown asks the guest to shut down orderly. It is not the same as a forced power-off. domstate reports its current state; shutdown can take time, so repeat the read-only state check until it says shut off without an error.

id -u
virsh -c qemu:///system shutdown vecta-lab-linux
virsh -c qemu:///system domstate vecta-lab-linux

If the VM is already shut off, inspect that state instead of issuing a second shutdown. If it is paused, resume it in its local console, then request normal shutdown. Do not copy a paused, running, saved or unrecognized state. If normal shutdown does not complete, diagnose the console; do not substitute a forced power-off and assume the same clean result.

The next read-only inspections answer different questions:

InspectionRequired observation
dominfoThe expected name and UUID; state shut off; Managed save: no; autostart disabled. A managed save contains additional guest state.
domblklist --inactive --detailsThe inactive definition's exact host disk source, one writable disk, and only the expected installation media if still attached. The target name such as vda is a guest device label, not the host file path.
snapshot-list --nameNo snapshot names and no error. This checks libvirt's snapshot records, not every possible internal image snapshot.
dumpxml --inactiveThe saved configuration used for the next boot, rather than relying on a running guest's temporary details.
virsh -c qemu:///system dominfo vecta-lab-linux
virsh -c qemu:///system domblklist vecta-lab-linux --inactive --details
virsh -c qemu:///system snapshot-list vecta-lab-linux --name
virsh -c qemu:///system dumpxml vecta-lab-linux --inactive

Autostart could start the VM when the virtualization service starts. If this owned VM alone has it enabled, autostart ... --disable disables that behavior. Then repeat dominfo and confirm it is disabled before continuing.

virsh -c qemu:///system autostart vecta-lab-linux --disable

Use that change only for the enabled case. Do not delete managed-save data or snapshots as an unexplained repair. A VM with either condition needs its setup reconciled before this procedure applies.

Read the XML alongside virt-manager's hardware details. Match the domain name and UUID, BIOS firmware, one writable file disk, its qcow2 format and exact source path, and the existing default NAT interface. Confirm there is no UEFI loader/NVRAM, virtual TPM, host directory sharing, host disk passthrough or other added state/device. If you cannot account for a device or file, stop. The saved disk alone cannot recover something stored elsewhere.

The following disk path is the default-pool example from setup: /var/lib/libvirt/images/vecta-lab-linux.qcow2. Use it only if the actual inactive disk Source exactly matches. If your authorized pool used another path, replace this complete path in every disk-inspection/copy/hash command below with that recorded path. Keep the single quotes around the whole path. Never substitute a physical path such as /dev/sda.

qemu-img info --backing-chain inspects image information and any backing images. This course needs one image, format qcow2, the planned virtual size, and no backing file or additional chain member. qemu-img snapshot -l lists internal snapshots without creating one. There must be no snapshot entries. Host sudo here permits reading this identified virtualization-owned file; it does not switch your terminal to a root account. Keep the VM shut off and do not bypass an image-lock error.

sudo qemu-img info --backing-chain '/var/lib/libvirt/images/vecta-lab-linux.qcow2'
sudo qemu-img snapshot -l '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

5. Host: make and verify a fresh clean copy

Create one new private host directory. mkdir -m 700 gives its owner access and withholds directory access from other ordinary accounts. The directory will contain an entire guest disk, so treat it as private even though the exercise uses synthetic files. If creation says the name exists, stop and use the resume section; do not reuse an unrecognized backup or change its permissions.

mkdir -m 700 ~/vecta-linux-vm-backup
cd ~/vecta-linux-vm-backup
pwd
ls -a

The directory must be the expected new host directory and empty. stat below reads file metadata: %F identifies its type; %h counts the directory entries that refer to that same host file (hard links); %s is its length in bytes, %u and %g are its numeric owner and group, and %a is its permission mode. Require a regular file with one link; a symbolic link, directory or extra hard link is outside this selected disk route. These fields belong to stat's quoted format, not shell variables. df -B1 . reports space on the filesystem containing this backup directory in units of one byte.

sudo stat -c 'type=%F; links=%h; %s bytes; uid=%u gid=%g mode=%a' '/var/lib/libvirt/images/vecta-lab-linux.qcow2'
df -B1 .

Compare the source file's byte length with Available in the filesystem report. Reserve at least that file length for the clean copy, with capacity left for the host and subsequent guest growth. The nominal 25-GiB virtual disk, host file length and allocated host blocks are different quantities; planning for the file length is a conservative check for this copy. If capacity is tight, stop and obtain a suitable owned storage location; do not free space by deleting unrelated host files. Record the original disk's byte length, owner, group and mode as well as the domain UUID and full source path. To recognize the same host file again, also record its filesystem device number and inode number. These identify the file within the host's filesystems; they are not guest disk labels. stat expands %d and %i for those fields without changing the file.

sudo stat -c 'device=%d inode=%i' '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

Save the inactive XML in this new directory. In this narrowly scoped bridge, > sends a command's normal text output into a file instead of the screen. It creates a missing file and truncates an existing file. Therefore first confirm vecta-lab-linux-clean.xml does not exist in ls -a, and do not rerun this line over an existing record. Error messages are still important: a file created by the shell is not proof that virsh succeeded.

virsh -c qemu:///system dumpxml vecta-lab-linux --inactive > vecta-lab-linux-clean.xml
cat vecta-lab-linux-clean.xml

Require a complete domain XML document and the same identity, disk and device checks from the previous section, with no command error. Record its digest: sha256sum computes a content fingerprint. Identical byte contents produce the same SHA-256 value; compare the complete 64 hexadecimal characters, not a short prefix. The filenames printed afterward will differ for copies.

sha256sum vecta-lab-linux-clean.xml
virsh -c qemu:///system domstate vecta-lab-linux

The second command must still say shut off. Keep virt-manager from starting the guest and do not allow another person or automation to use it while copying.

cp copies the source file to the destination. In -ipT, -i asks before overwriting an existing destination, -p preserves mode, ownership and timestamps, and -T treats the destination as exactly one file path rather than a directory to copy into. --reflink=never requests an ordinary copy rather than a copy-on-write clone. -- ends options before the pathnames. sudo is needed for the virtualization-owned source and preserved ownership.

sudo cp -ipT --reflink=never -- '/var/lib/libvirt/images/vecta-lab-linux.qcow2' vecta-lab-linux-clean.qcow2

This initial destination must be new. If any overwrite prompt appears, answer n and stop. Do not replace an existing clean copy. On any copy or metadata preservation error, keep the VM off and regard the destination as unverified. Do not infer success solely from a returned prompt.

Check both file contents and metadata while the VM is still shut off:

sudo sha256sum '/var/lib/libvirt/images/vecta-lab-linux.qcow2' vecta-lab-linux-clean.qcow2
sudo stat -c 'type=%F; links=%h; %s bytes; uid=%u gid=%g mode=%a' '/var/lib/libvirt/images/vecta-lab-linux.qcow2' vecta-lab-linux-clean.qcow2

The two hashes must match completely. Both must be regular files with one link, and their metadata records must match in length, owner, group and mode. Record the clean-copy digest on the host and leave that copy unchanged during both tests.

As a concrete host-boundary check, record the hash of the retained public installation ISO from setup and the VM inventory. This reads that file; it does not change it. Use your recorded ISO path if the pool differs.

sudo sha256sum '/var/lib/libvirt/images/vecta-lab-linux-install.iso'
virsh -c qemu:///system list --all

These observations let you recheck that named host resource and other recorded VM entries later. They do not amount to a scan proving every host file is unchanged. Every write in this procedure must remain limited to the owned backup records or the exact owned guest disk.

6. Guest: create a change after the clean copy

On the host, virsh start boots the existing named VM from its current definition. It does not create a new VM or import the saved XML.

virsh -c qemu:///system start vecta-lab-linux

Return to its local guest console, sign in normally and check id -u. Enter the exercise directory and confirm it is still empty. nano opens the named text file in the terminal editor; a missing name starts a new file. Type the supplied text as file contents, not as a shell command. In nano, Ctrl+O, Enter saves the displayed filename; Ctrl+X exits. If you made a typing mistake, correct it in the editor before saving. These key names are actions, not text to type.

id -u
cd ~/linux-practice/verify-and-reset-the-guest
pwd
ls -a
nano marker-one.txt

Enter this one line, then save and exit:

Marker one was written after the clean copy.

cat displays the saved file so you can check the actual result, rather than assuming the editor saved it:

cat marker-one.txt

Record that exact line and the guest path on the host. You now have evidence that the marker really existed after the backup. Do not delete it.

7. Host: restore only the rechecked stopped disk

Restore is the destructive step. It replaces all later guest disk contents with the saved baseline. Confirm there is no later guest work you need to keep, and that the clean copy has passed the checks above. Return to the host and the private backup directory. Request ordinary shutdown and wait for observed shut off again.

cd ~/vecta-linux-vm-backup
pwd
virsh -c qemu:///system shutdown vecta-lab-linux
virsh -c qemu:///system domstate vecta-lab-linux

Rerun the earlier dominfo, domblklist --inactive --details, snapshot-list --name, qemu-img info --backing-chain and qemu-img snapshot -l checks against this same domain and disk. State, UUID, disk source, disabled autostart, no managed save, no snapshots and standalone image conditions must still hold. The guest can change disk contents without changing the VM's definition; a changed disk path or device is a different situation.

Use a new XML record for this restore. Check ls -a first: the following output name must not already exist. Save the current inactive configuration and compare its full digest with the saved baseline XML.

ls -a
virsh -c qemu:///system dumpxml vecta-lab-linux --inactive > vecta-lab-linux-before-restore-one.xml
cat vecta-lab-linux-before-restore-one.xml
sha256sum vecta-lab-linux-clean.xml vecta-lab-linux-before-restore-one.xml

Require a complete document, no export error and identical XML digests. An unexpected difference means stop and inspect the definitions; do not overwrite the saved XML to make them agree. Do not redefine the VM from either file.

Recheck the saved disk's hash against your recorded clean digest and inspect its metadata. It must still be the verified clean copy, not an incomplete copy or a newly copied marker-containing disk.

sudo sha256sum vecta-lab-linux-clean.qcow2
sudo stat -c 'type=%F; links=%h; %s bytes; uid=%u gid=%g mode=%a' vecta-lab-linux-clean.qcow2
virsh -c qemu:///system domstate vecta-lab-linux

The destination must be the same existing disk file recorded before backup. Recheck it before any write. Its type must be regular, link count one, and device/inode, owner, group and mode must match the original host record. The current file length can have grown as the guest worked. A missing file, symbolic link, directory, changed identity or unexpected metadata means stop: do not let cp silently create a new disk at that path.

df -B1 now names the actual destination file, so it reports the filesystem that will receive the restore rather than assuming the backup uses that same filesystem. Reserve at least the clean image's byte length in available space, with capacity left for normal host activity. This is a conservative copy-space check, not a statement that every restore allocates that many new blocks.

sudo stat -c 'type=%F; links=%h; %s bytes; uid=%u gid=%g mode=%a' '/var/lib/libvirt/images/vecta-lab-linux.qcow2'
sudo stat -c 'device=%d inode=%i' '/var/lib/libvirt/images/vecta-lab-linux.qcow2'
sudo df -B1 '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

The following copy reverses source and destination: read the clean image, write the current course disk. Unlike the first copy, one overwrite prompt is expected. Read its exact destination. Answer y only when it identifies your rechecked owned disk and all the conditions above hold. An unexpected path, missing destination, directory, lock, space or permission error means stop.

sudo cp -ipT --reflink=never -- vecta-lab-linux-clean.qcow2 '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

Do not start the guest yet. Verify the resulting bytes and preserved metadata:

sudo sha256sum vecta-lab-linux-clean.qcow2 '/var/lib/libvirt/images/vecta-lab-linux.qcow2'
sudo stat -c 'type=%F; links=%h; %s bytes; uid=%u gid=%g mode=%a' vecta-lab-linux-clean.qcow2 '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

Both hashes must match the recorded clean digest. Length, owner, group and mode must match the saved values; both files must remain regular with one link. Recheck the target's device/inode against the original record as well. Only after an error-free copy and these checks may you start the same guest with the already taught virsh start command.

If the copy is interrupted or a check fails, leave the guest shut off. The target might contain a partial image. Reconfirm the VM and disk identity and the intact clean copy, resolve the actual capacity or access problem, then repeat the restore and all resulting checks. Do not boot a partial disk, change permissions broadly or replace the clean copy with the damaged target.

8. Guest and host: check what recovery proves

In the booted guest, sign in with the same ordinary account. Recheck the OS, architecture, user, Bash/coreutils versions and PID 1 using the commands from Section 1. Check the package status inventory if setup changes were part of your baseline. Then inspect the actual exercise path:

cd ~/linux-practice/verify-and-reset-the-guest
pwd
ls -a
cat marker-one.txt

The directory should contain only . and ... The last command should report that the named file does not exist. Here that expected error is useful evidence, combined with the earlier record proving the file existed. Do not remove the file yourself to manufacture the result. If the directory itself is missing, you did not recover the intended baseline or are inspecting the wrong account or path; marker absence alone does not pass the exercise.

On the host, repeat the retained ISO hash and virsh list --all. The ISO digest must match the earlier record. Account for the expected owned VM state; unrelated recorded VM entries and their disk destinations have not been targets of any write. Preserve the clean image and inactive XML.

Your evidence now connects five observations: this named guest passed readiness; its empty fixture was included in a verified stopped copy; the later marker existed; recovery wrote that clean copy back to the same stopped disk; and the booted baseline has the empty fixture again. A screenshot of an empty directory on its own would establish much less.

Diagnose a different result

ObservationMeaning and safe next action
User ID is 0, OS/architecture differs, or PID 1 is not systemdThe selected learner route is not established. Return to the named VM and normal account; do not claim that installed tool names prove the environment.
man -w reports a missing pageLocate the missing package/manual through the official guest setup; do not skip the dependency because the command might exist.
Repository errors or no official Noble tree candidateRead the exact setup evidence and configured sources. Resolve that condition before calling readiness complete.
VM is paused or has managed-save/snapshot/extra stateThe one-disk reset model does not apply yet. Reconcile the declared setup; do not erase unfamiliar state.
Disk or backup is reported busy, inaccessible or too large for available spaceStop before copying. Check actual shut-off state, exact owned path and capacity. Do not bypass locks or open broad permissions.
Clean-copy or restored-disk hashes differThe intended byte-for-byte result is not established. Keep the guest off and the known clean copy unchanged while checking errors and source/destination identity.
Saved and current inactive XML differVM configuration changed. Read the differences before deciding whether this recovery model still applies; do not force agreement by replacing the baseline record.
Marker still exists after bootCheck guest identity, account/path, backup timing and restore evidence. Perhaps the marker was included in the supposed clean copy. Do not delete it to pass.
Marker absent but baseline directory or tools also absentYou may have restored a different state. Compare the complete readiness and baseline record.

Independent task: a second recoverable change

Start with the successfully restored guest, the unchanged clean image and its saved XML. Your task is to demonstrate the same boundary with a different input, using the procedure above without reading the answer yet.

  1. In the ordinary guest account's exercise directory, create marker-two.txt with nano. Its exact content is Marker two tests the same saved baseline. Save, reopen/read it, and record the evidence on the host.
  2. Recover the same saved baseline. Repeat every state, identity, snapshot, backup-integrity and metadata check. Use the fresh host XML name vecta-lab-linux-before-restore-two.xml for this attempt; preserve the first restore record and the original clean XML.
  3. Show that the same ordinary guest account and empty baseline directory return, marker-two.txt is absent, and the recorded host ISO hash remains unchanged. Explain why the first clean copy was reused.
  4. Explain three decisions: why a running-disk copy was refused; why a marker made before backup would be a poor test; and why a matching disk hash before boot does not replace the post-boot guest checks.

Hints

Hint 1 — reconstruct the states: the clean image must remain unchanged. Create the second marker only in the booted guest, then return to the host for shutdown and inspection.

Hint 2 — follow the objects: the clean image is the restore source; the recorded virtualization disk is the destination. The new XML is a comparison record. It does not create or redefine a VM.

Hint 3 — evidence chain: confirm the marker's saved content first, the VM's actual shut-off state and exact identity next, matching clean bytes after copy, and the expected ordinary account and empty fixture after boot. Do not replace any one of these with a guessed success.

Answer and Reasoning

The early prediction has a direct answer: a marker made before the clean copy would be part of that copy. Restoring it should retain the marker. A useful recovery test creates an identifiable change after the baseline is saved.

For the independent task, begin in the guest with the ordinary account and the restored empty directory. Check the path, open the new file, and save the supplied line with Ctrl+O, Enter, Ctrl+X:

id -u
cd ~/linux-practice/verify-and-reset-the-guest
pwd
ls -a
nano marker-two.txt

The file contents are:

Marker two tests the same saved baseline.

Then verify them:

cat marker-two.txt

On the host, repeat Section 7's complete shutdown and inspection sequence. The domain UUID, disk path, state and no-extra-state conditions are unchanged. In the private backup directory, after confirming the second record is absent, the XML portion is:

virsh -c qemu:///system dumpxml vecta-lab-linux --inactive > vecta-lab-linux-before-restore-two.xml
cat vecta-lab-linux-before-restore-two.xml
sha256sum vecta-lab-linux-clean.xml vecta-lab-linux-before-restore-two.xml

Require matching complete XML, verify the clean-image digest against the saved record, recheck shut-off state, and use the same guarded restore command and post-copy checks from Section 7. Answer the expected overwrite prompt only for the exact recorded disk. Start the VM only when restored bytes and metadata match. This reuses the known earlier state instead of accidentally promoting the second marker into a new baseline.

After login, recheck the guest readiness and inspect the fixture:

id -u
cd ~/linux-practice/verify-and-reset-the-guest
pwd
ls -a
cat marker-two.txt

The nonroot account and expected path must match the baseline record; the directory has only . and .., and cat reports the absent second marker. Recheck the retained ISO hash on the host. These are explained result checks, not an automatic score.

A live copy was refused because the selected method needs a stable stopped disk boundary; ongoing writes and additional runtime state would break that assumption. A paused guest still has runtime state and is not the declared shut-off state. A matching restored image hash establishes the copied bytes, but it does not show which VM was subsequently booted, which account signed in or which directory was inspected. That is why the post-boot checks matter.

The selected Ubuntu/Bash/systemd families are the plan. Your recorded outputs, completed copy checks, boot and two marker recoveries are evidence about the machine on which you actually performed them. Neither a platform label nor reading this lesson supplies that evidence by itself.

Resume, reset and retain the useful state

After both successful restores, the baseline exercise directory is empty; the restore itself removed the temporary markers. Keep the guest, checked packages, private clean disk copy, original inactive XML and host verification records. Keep the setup ISO and shared host virtualization tools. No deletion command is needed to finish this exercise.

Last trustworthy stateHow to resume safely
Guest checks complete, no verified clean copy yetInspect the known exercise directory. If a marker was created too early, use a separate fresh owned baseline or deliberately reconcile that file before recording a clean state; do not silently call it empty. Repeat readiness and stopped-state checks.
Backup directory exists but copying was interruptedTreat the partial file as unverified. Keep the VM off until its source state is understood. Preserve the existing directory and make a separately named new private directory for a fresh attempt; use that chosen name consistently. Never overwrite the one verified clean copy.
Verified baseline exists and a marker is presentKeep the baseline unchanged. Continue with the complete stopped-disk restore checks, using a new, clearly named XML comparison record.
Restore interrupted or its hash/metadata check failedLeave the VM off. Verify exact identity and the intact clean source, resolve the actual error, then repeat the full restore and verification before booting.
Restored disk verified, guest not yet startedReconfirm no one changed the disk or VM configuration, then boot the same VM and finish the guest and host checks.

Do not restore this early baseline later in the course without deciding what subsequent guest work would be lost. The saved XML is retained to identify the original configuration; it is never permission to overwrite a different VM's disk. If a required observation cannot be established, record the specific condition and keep that part of the exercise unfinished.

Technical references

The selected Ubuntu packages, required utilities and version families use the official sources identified in this lesson's source metadata. The procedures above are original course exercises based on these command and platform references:

Use Revision to reconstruct the decisions and Quick Reference to find a check after learning the full sequence.

Study this course with an account

Course access adds revision notes, the Quick Reference, saved progress, bookmarks and your own notes.

INR 99 plus 18% GST. 90 days of online access. No auto-renewal.

See course access

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy