CT320 Partitioning Lab
Introduction
For this lab, you will create a new disk partition and use it in various
ways.
                
Create a document that will hold your numbered results.
Show it to the TA for credit when you’re done.
                
Many commands in this lab will have to be done as the super-user,
root
. Do this by putting sudo in front of the necessary commands.
I won’t clutter the writeup with all the sudo
s.
                
Note that the opposite of the mount command is umount, not
unmount
.
                
Part 1 — Boot from DVD
- Boot from DVD, as shown in the Installation lab.
- Select “Try Xubuntu”.
- Do not install Xubuntu again.
- After some time, desktop screen will appear.
You’re now booted from the DVD with a RAM volume as your root disk.
- Run
gparted
, the Gnome Partition Editor.
Part 2 – Create a new partition
- There should be two large partitions,
/
(on the left) and /home
(on the right).
- If you’re doing this lab in the morning, then the size of your
new partition will be 30MB. Otherwise, it will be 60MB.
- Shrink the
/home
partition, to free space for your new partition.
- Right-click on
/home
- Select Resize/Move
- Set Free space following to the size of the new partition (30MB or 60MB).
- Click the Resize/move button
- Create a new partition in the unused space:
- Right-click on the unused space.
- Make it as big as you can (roughly 30MB or 60MB).
- Change the Label to your name.
- Click “Add”.
- Click the green check mark.
- Let it do its job.
- Close
gparted
.
- Reboot to Linux from the hard disk, as usual (remove the DVD).
Part 3 — Verify
- Look at
/proc/partitions
, figure out which one is the new
partition, based on its size.
/proc/partitions
sizes are in kilobytes.
- It’ll have a name like
sd
letter digit,
for example, sda2
.
- In commands, put
/dev/
in front of the name.
- Record the device name in your document.
Part 4 — Manually mount & unmount
The mount point for this new partition will be /Spare
.
                
rm -rf /Spare
- In case there’s one left over from a previous lab.
mkdir /Spare
chmod a+rwx /Spare
uptime >/Spare/up
mount
device-name /Spare
- Is
/Spare/up
still there?
- Create a few files, named after dogs, in
/Spare
.
ls /Spare
umount /Spare
- What’s in
/Spare
, now?
- Record your results in your document.
Part 5 — /etc/fstab
It’s tedious to have to manually mount
filesystems.
Think of /etc/fstab
as setting up an association between
directories (mount points) and partitions (file systems).
                
- Edit
/etc/fstab
, and add an entry to mount your new partition.
- Find the entry for
/home
and imitate that.
- Change the first field to the device name (
/dev/sda
whatever)
or you can use LABEL=
your-name
umount /Spare
- It should be no longer mounted. How can you tell?
mount /Spare
- Note that no device name is given, just a directory.
- It should be mounted, now. How can you tell?
- Record your results.
Part 6 — Busy due to current directory
cd /Spare
umount /Spare
- How did that go?
cd /tmp
umount /Spare
- Record your results.
Part 7 — Busy due to open file
mount /Spare
cd /tmp
sleep 10m >/Spare/output &
umount /Spare
- How did that go?
kill %%
umount
- Record your results.
Part 8 — Dual Mount
mount /Spare
rm -rf /Extra
mkdir /Extra
- Manually mount your partition onto
/Extra
(mount /dev/sda
whatever /Extra
), while leaving it
also mounted onto /Spare
.
- Create a file in
/Extra
. Did it show up in /Spare
?
- Unmount both
/Spare
and /Extra
.
rm -rf /Extra
- Record your results.
Part 9 — Read-Only
- Mount
/Spare
, but do it read-only.
man mount
is your friend.
- Copy a file to
/Spare
using the cp
command.
- Record the results. If there was an error message, copy it exactly.
- Unmount the
/Spare
partition
Part 10 — noexec
Many systems allow non-super-user mounting of CDs and USB drives,
but don’t want executables to be run off of those devices.
                
mount -o noexec /Spare
cp -a /bin/date /tmp
/tmp/date
cp -a /bin/date /Spare
/Spare/date
- Record the results. If there was an error message, copy it exactly.
Part 11 — Cleanup
- Unmount the
/Spare
partition
rm -rf /Spare
- Run
gparted
from Linux (don’t use the DVD) and deallocate
your new partition. You don’t have to merge it the free space back
into /home
; you can just leave it unallocated.
Part 12 — Credit
Show your work to the TA.