Prepare a FAT USB Stick

Linux lab Beginner 5 tasks 10 points

You need a USB stick that any computer — Linux, Windows or macOS — can read, so it must use the vfat (FAT) filesystem. The stick is the image usb.img (32 MiB) in your home directory, and holiday.txt is the file to put on it. Password: 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

Formatting FAT is mkfs.vfat; -n sets the label.

Writing into /mnt/usb needs sudo, since root owns the mount point.

Solution explanation

FAT is the one filesystem almost every device understands, which is why USB sticks use it. sudo losetup -fP --show usb.img attaches the image, sudo mkfs.vfat -n TRIP /dev/loop0 formats it as vfat with the label TRIP, and after mounting at /mnt/usb you copy the file across with cp. blkid confirms the type is vfat.

Show solution
sudo losetup -fP --show usb.img
sudo mkfs.vfat -n TRIP /dev/loop0
sudo mkdir -p /mnt/usb
sudo mount /dev/loop0 /mnt/usb
sudo cp holiday.txt /mnt/usb/
lsblk -f /dev/loop0
HOME LEARN COMMUNITY DASHBOARD