Operating Systems Concepts & Design
ssh config fileMake sure to return to the AWS Learner Lab page (link in Pilot if you forgot to bookmark it) and hit “Start Lab” to turn on your sandbox / AWS instance.
Use ssh to connect to your AWS Ubuntu instance.
Go to the folder that contains your repository (likely named ceg2350-yourgithubusername).
Create a new directory, Lab08.
Create a file named README.md in the Lab08 folder. The Lab 08 Template can be copied from this link:
https://raw.githubusercontent.com/pattonsgirl/CEG2350/refs/heads/main/docs/Labs/Lab08/LabTemplate.mdYou may refer to additional resources outside of the recommended resources provided.
Any resource that you use that contributes to your understanding of exercises in this lab should be cited in the Citations section of your lab answers. To add citations, provide the site and a summary of what it assisted you with. If generative AI was used, include which generative AI system was used and what prompt(s) you fed it.
If you make mistakes with commands in the lab, note them! Writing down what went wrong and what the correction was will significantly help your learning journey. If you cannot find a correction, it will help the TAs or myself understand what point you reached and determine some potential solutions.
Create a new AWS sandbox. Your current sandbox is likely in a working state. By creating a second sandbox, if you make any errors playing with the partition tables and filesystems you can destroy and rebuild without affecting your working instance where you have set up an SSH key to your GitHub profile and cloned your repository.
To set up your sandbox environment for this lab, return to Getting Started with AWS Academy and complete steps 8-13 - you’ll use your same private key to connect to the new sandbox environment. The new sandbox will also have the same default username - ubuntu. It will have a unique Public IP.
Once you sign in, I recommend changing the hostname of the system so that you can tell the two instances apart when logged in. On the instance you are making for this lab, run the following command to change the name:
sudo hostnamectl set-hostname disklab-sandbox
To see the new hostname, sign out of the system (disconnect from your current ssh session), then connect back to the system.
ssh config fileDid you read BEFORE YOU BEGIN? Got a second sandbox up? Good. Proceed.
Since you now have two sandboxes, it’s going to be a helpful time to learn a common strategy to configure ssh connection.
ssh commands for connecting to each of your sandboxes.config file for ssh:| ssh config Option | Description |
|---|---|
Host |
|
HostName |
|
User |
|
Port |
|
IdentityFile |
~/.ssh/config - one for use for each of your sandboxes. Copy your config file contents to your lab template.
.ssh folder in your user’s home directory on your system - you’ll need to make the folder and the config file inside of it.config file in C:\Users\yourusername\.sshssh <host_block_name> that you can connect to each sandbox. Write the working commands into your lab template.Resources
Your AWS instances have one block device in use - xvda. In this section, you will explore commands view partition and filesystem information about xvda. Do not make any modification to xvda.
Hint, remember that disk devices are in the /dev/ folder
lsblk, parted, blkid, df, catFor tasks that ask you to use a command, write the command used and include the output of the command.
lsblk to list only information about the xvda block device.parted to print the partition table of the xvda block device.xvda partition table:
blkid to view information of xvda and it’s partitions. Play with * to get all matches that start with \dev\xvdadf to view file system disk space usage in human readable format (meaning it prints MB/KB/GB)/etc/fstabResources
parted/etc/fstab file on LinuxYou have had an unformatted disk available on your AWS instance all along. The disk is xvdb - you can see it, but that it has no partitions, if you run lsblk. Time to create a partition table and a partition on /dev/xvdb so that in the next Part we can create a filesystem on the partition and mount it for use.
df, lsblk, blkid, gdiskgdisk GPT partition table manipulator, find out what the following main menu options do:
poniwxvdb block device with gdisk. Using the main menu, configure the disk to use the GPT partition table type, have at least 1 partition, and have that partition use the Linux filesystem type. Save your changes to the disk.
xvdbxvdb in its current state:
Resources
gdisk”gdiskNow that you have a partition, you can create a filesystem on it in order to interact with it to store and organize files and create permissions for the files.
mkfs, mountext4 filesystem on the partition on xvdbblkid to view information of the partition on xvdb/mnt/ named expansexvdb to expanseexpanse create some files and directoriesumount the partition on xvdbxvdb?Resources
ext4 is folded into ext3 since it makes slight improvements over ext3fstab at thisRight now, every time you want to access your new filesystem on xvdb1 after a system reboot you need to mount it. It would be handy to have it auto-mount. The filesystem table file - fstab is a file that stores information about what to mount when the system boots. Your task in this part is to append a new entry to fstab to automount the filesystem on xvdb1.
/etc/fstab to /etc/fstab.bak/etc/fstab to mount the partition on xvdb to the mount point (/mnt/expanse)mount -a to mount / remount records entries in etc/fstab and then check that your additional entry worked (make sure xvdb1 is unmounted first, then test and verify)/etc/fstab from /etc/fstab.bak. If you think they are correct, you may leave your changes in place.Resources
When you delete a file, you are used to it no longer being accessible, or to it still being temporarily available / recoverable via the Recycle Bin. But once you can’t open it anymore, it should be gone, including from the disk, right? Right?!?
This part will have you acknowledge that to truly make data gone and no longer readable, there are extra steps involved. The general recommendation is to trust nothing, and take disks that have had important data on it, like tax returns, credit card info, passwords, etc, taken to a shredding center and properly ripped to computer-illegible pieces.
mount, stringsxvdb partition, create two files, each with a different FAKE secret about you.strings command. If you referred to an internet resource, make sure you cite it by including the URL.strings on the filesystem partition on xvdb - read through the output and make an analysis about what output you are viewing.strings on the filesystem partition on xvdb - read through the output and determine if the secret, while no longer accessible via the filesystem, is still readable on the partition.shred command. If you referred to an internet resource, make sure you cite it by including the URL.shred to overwrite the contents of your second secret file on the disk. Write a short report of steps and provide proof that the file is no longer readable on the disk or accessible in the filesystem. Include an explanation of flags used (if any).Resources
Any resource that you use that contributes to your understanding of exercises in this lab should be cited in the Citations / Resources section of your lab answers. You may refer to your own notes (if they are digitized into GitHub), course notes, or external resources / websites.
To add citations / resources, provide the reference / link and a summary of what it assisted you with.
If generative AI was used, include which generative AI system was used, what prompt(s) you fed it, and a summary of what it assisted you with.
We expect a minimum of one citation / useful resource per part of your lab. So this lab would require a resource for:
ssh config filegdiskmkfsfstab filestringsNow that you have made a virtual machine, a thought might be how does it use the disk space on your host. In the context of a virtual machine, the reserved space on the host has a partition table, partitions, and a filesystem mounted to /
Use guides to create a guide on how to complete this tasking.
dd or fallocate to reserve 2 GB of space (a “file”) from /dev/xvda./mnt/vfs (vfs for virtual filesystem).Resources
fallocateddVerify that your GitHub repo has a Lab08 folder with at minimum:
README.mdIn the Pilot Dropbox, paste the URL to the Lab08 folder in your GitHub repo
Your files should be cleanly presented in your GitHub repository. Citations should be included as needed. Include which generative AI system was used and what prompts were used if generative AI was used.