Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Lab 14.1RH124, Hoofdstuk 14

Mount a USB disk and an ISO file, then remove them safely

Niveau
Makkelijk
25 min
Machines
server1
Status
Nog niet begonnen

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Doel

Practise the full life of removable media on server1: find a new disk, mount it, copy files to it, fix a "target is busy" error, and read an ISO file. No real USB stick is needed — you add a small virtual disk.

Voordat je begint

  • server1 with RHEL 10 (or CentOS Stream 10 / AlmaLinux 10) and root access.
  • Add a new empty virtual disk of 1 GiB to server1 (in virt-manager: Add Hardware → Storage, bus USB if you can choose, else VirtIO). It plays the USB stick.
  • An ISO file on server1, for example the RHEL 10 DVD ISO in /root/. Any ISO works.

Taken

  1. Find the name of the new disk. Write down its size and whether the kernel sees it as removable.
  2. Make one partition on the new disk that uses the whole disk, and format it as vfat with the label LABSTICK.
  3. Mount it on /mnt/usb so that the user student owns all files on it.
  4. As student, copy /etc/os-release to the stick.
  5. Open a second shell, cd /mnt/usb in it, and try to unmount the stick in the first shell. Find the reason for the error and fix it, then unmount.
  6. Mount the ISO file read-only on /mnt/iso and list the folders in it. Then unmount it.

Controleer je werk

lsblk -f
findmnt /mnt/usb
ls -l /mnt/usb/os-release
findmnt /mnt/iso

Hints

Toon de hints

Oplossing

Toon de oplossing
  1. Compare the disk list. Here the new disk is /dev/sda (it can be /dev/vdb on VirtIO).
    lsblk -o NAME,SIZE,RM,TYPE
  2. Partition and format it.
    parted -s /dev/sda mklabel msdos mkpart primary fat32 1MiB 100%
    mkfs.vfat -n LABSTICK /dev/sda1
  3. Mount it for student (UID and GID 1000 on most test systems; check with id student).
    id student
    mkdir -p /mnt/usb
    mount -o uid=1000,gid=1000 /dev/sda1 /mnt/usb
  4. Copy the file as student.
    cp /etc/os-release /mnt/usb/
    ls -l /mnt/usb
  5. The second shell is inside the folder. Find it, leave the folder there, then unmount.
    umount /mnt/usb
    fuser -vm /mnt/usb
    umount /mnt/usb
  6. Mount the ISO read-only with a loop device.
    mkdir -p /mnt/iso
    mount -o loop,ro /root/rhel-10.0-x86_64-dvd.iso /mnt/iso
    ls /mnt/iso
    umount /mnt/iso

Mijn notities

Nog geen notities.

Lessen voor dit lab

Commando's in dit lab