1.5. Changing files

Changing files in your running VM

In the previous chapter, we gained access to the VM’s console. In this chapter, we will use this access to make a change to our running VM and observe what happens if we restart the VM.

Task 1.5.1: Create a file

Head over to your VM console with:

virtctl console lab01-firstvm --namespace lab-<username>

Login with the specified credentials and create a file:

touch myfile

Verify that the file really is present. Check it with:

stat myfile

Task 1.5.2: Restart VM

Exit the console and restart your VM with:

virtctl restart lab01-firstvm --namespace lab-<username>

The output should be:

VM lab01-firstvm was scheduled to restart

Task 1.5.3: Persistency check

Ask yourself:

  • After restarting, is the created file still present?
  • And why do you think so?

Try to find out!

Task hint

Enter the console again with:

virtctl console lab01-firstvm --namespace lab-<username>

Check the file status with:

stat myfile

The output fill be:

stat: can't stat 'myfile': No such file or directory

This means that the file is gone. But why?

Do you remember that the VM manifest contains a container disk as volume? A container disk is always ephemeral and is therefore an easy way to provide a disk which does not have to be persistent. We will have a closer look about storage in a later section.

End of lab