Format and Mount Your First Disk

Linux lab Beginner 5 tasks 10 points

A blank disk image, disk.img (64 MiB), is waiting in your home directory. Turn it into usable storage: attach it, put an ext4 filesystem on it, mount it at /mnt/data, and leave a file on it. Installing and mounting need sudo; your password is student.

How it works: the terminal below is a real Linux machine running in your browser. Click it and type. Tasks tick themselves off as you complete them; questions are answered in the box under each task. Press Reset any time for a fresh machine. Your password on this machine (for sudo) is student.

student@vulntech:~ Starting…
Getting your Linux machine ready…
The first start downloads about 20 MB. After that your browser keeps it, and labs start in a moment.

Hints

The order is attach → format → mount → use: losetup, mkfs.ext4, mount.

losetup -fP --show prints the device name it chose; here it is /dev/loop0.

Solution explanation

losetup -f reports the first free loop device, /dev/loop0. sudo losetup -fP --show disk.img attaches the image there, sudo mkfs.ext4 /dev/loop0 formats it, and sudo mount /dev/loop0 /mnt/data attaches that filesystem onto the directory. After that, writing ready.txt under /mnt/data stores it on the disk.

Show solution
sudo losetup -f
sudo losetup -fP --show disk.img
sudo mkfs.ext4 /dev/loop0
sudo mkdir -p /mnt/data
sudo mount /dev/loop0 /mnt/data
echo done | sudo tee /mnt/data/ready.txt
HOME LEARN COMMUNITY DASHBOARD