 Let's explore a few options we have for managing our virtual machines within virtual box So I have my Ubuntu Linux demo virtual machine, which is powered off I actually have a couple of others Kali Linux, which is powered off uses 2 gig of RAM and Ubuntu desktop version, which is in a save state Let's have a look at the states of difference between saved and powered off. So we start our machine and And it will boot up takes a minute or so to boot up Powered off means we've shut down the machine save means that it's like Suspending your computer or your laptop So when you restart it, you start off from where you left off. You don't have to boot up again. So let's see that in action So it's booting up And then we will log in Eventually, okay Password I'm logged in to my machine and If we want to shut down we can Use the command line and use pseudo power off or we can simply close here and it gives us three options Power off machine is like pulling out the power cable Now you may lose data in that case So you generally don't want to do that But if there's no other option if the service crash, then maybe that's all you can do to shut it down the preferred mode will be to send the shutdown signal which Tells the operating system is going to shut down. It's like issuing a special command So the operating system will gracefully shut down. That's the preferred mode Whereas saving the machine state doesn't shut down but saves the current state So when we start it again, we start off with where we left off. So let's try that Takes a bit of time to save to and it saves some extra information to disk and now it's not just Saved so if we start it again We will not go through the full boot process Instead virtual box loads the state from disk Restores the virtual machine takes a few seconds and we're back to Sorry, we'll close that we'll return back to that message. We're back to our Where we were logged into the machine So I recommend making use of saving the state rather than shutting down and rebooting all the time What was that message that come up just then if I actually you may see some messages which come up about the mouse about the The size of the window will see other ways that we can increase the size of this window will get a nicer do we Terminal at a later stage So that's saving the machine state Another thing we may want to do is from particular machine is take a snapshot So take a record at one particular point in time of how the system is So here we're logged in We have some software that says some software can be updated So a snapshot could be useful in saying, okay, let me record the state of the system now Then install some software if something goes wrong I can revert back to the previous state that previous snapshot. So that's a good use for snapshots To view and take snapshots, you can see from the menu Noting on different versions of virtual box, it may look differently, but there's usually an option to see snapshots and Currently there are none. It's just in the current state If I right-click and take a snapshot, I can choose it Give it a name initial logon login and It takes a snapshot. Okay, and now I do some things inside my machine run a few commands Look at the history which shows me I've run a few commands. I've run LS echo holo in history. Okay, and Noting here, we have our current state and our initial login in the current state of run three commands The initial login snapshot was before I ran those commands So if I decide well, I don't want to have those commands run. What I can do is I can shut down I Can power off the machine? Essentially deleting the current state and restoring back to the initial login snapshot. Let's try that and to see that take effect we'll start and We'll see that those three commands that I ran are no longer there Let's hope so It's restoring the machine And it restores it to the initial Login state we get a warning message here and this is a message coming from the kernel pond boot Maybe it's pro referring to the network adapter. This EMP zero s3 is my Ethernet adapter. It's gone through some reset possibly due to a network issue on my host computer Are the commands there? What's my history of commands that LS command and echo hello command are no longer there because we've revert it back to the Initial login snapshot losing the current state So we can take snapshots points in time and you can take multiple for a particular machine the other thing we may want to do is to copy the machine and There's two approaches for doing it. So I'll just shut down and Yeah, we'll revert so we've got our machine here and I Want to take a copy of it? So if you look inside the directory where your machines are stored in my case are in my user directory and There's a folder called virtual box VMs inside there It's got folders for each of my three VMs a bunch of Linux demo inside. There is a vbox file and The disk image is 2.5 gigabyte image some log files and Records of the snapshots Noting that taking a snapshot each time requires saving of some information and that's in this These two files here One way to copy the virtual machine is simply copy this whole directory and that's useful for backups or copying and moving to another computer copy this directory using normal mechanisms and You can then open a copy of this virtual machine elsewhere say on your home PC But you generally don't want to copy the virtual machines if you want to run to on the same computer that's called cloning and Virtual box has a way to do that. So we can copy the folders for backup purposes But if you want to have a second machine based on the first one we can clone So inside virtual box there's a clone option and the new clone Call it dash to No, there has an option to re-initialize the MAC addresses for network cards. So there are hardware addresses and If I don't choose this option the second machine will have exactly the same values as the first machine Although it's not true in practice in theory MAC addresses should be unique across computers And we may want to really re-initialize them Get new values a full clone or a link clone a full clone essentially will copy everything a Link clone will just copy and keep track of the differences from the old one Full clones are probably sufficient link clones are useful if you're making many copies and you're keeping a Reference machine and having clones all linking back to that single one, but we'll stay with the full clone Do we want to copy the Snapshots or just the current machine state. Let's just get the current machine state and Now it clones that will clone the disk I have 2.5 gigabyte disk image and that may take some time because essentially it's Copying and pasting that that file Says it's going to take 23 minutes that seems excessive, but There we go much faster than that and it's cloned Here we have it gone to Linux demo 2 and Note in my folder. I have This and if we looked at the details, we should see that they essentially the same machines put this one up And while that one's starting We can start this other one as well the original So here is demo 2 and this is the original and it's restoring We have two virtual machines now two different ones essentially having the same set up So that's useful if you want to build a base system And then you want multiple servers for example multiple different servers which have Based upon that original system you can clone the original system as many times as you need And we can run them in parallel So that's some of the features we including saving machines snapshots For backups you can simply copy the the folder and for duplicating machines. We can clone them Last thing we may want to do is right with client. We've got this second client here We don't need it anymore. We can delete it. Well, that's quite easy I'll just close that Power it off. I'm not going to use it and to delete Okay Remove the machine now. This is important. There's delete all files or remove only Here removing only will leave some of the the disk image and the some log files possibly there Generally, if you no longer need it, you can delete all files and that gets rid of everything and note that the folder Disappeared here. So it's completely gone If you don't delete all files and then you recreate one with the same name there could be complex So be careful There are other tools available inside virtual box which you can explore but that gives us some basic tools to to manage our machines