$
Apprendre Manuel Linux
fr
XP :0
Quête 131Block Master
+220 XP

Block Cloning & Temp Files (dd & mktemp)

Lancer le terminal interactif pour cette quête→Aucune installation requise • S'exécute dans le navigateur

Concept et aperçu

Sometimes system administrators need to manipulate raw disk blocks rather than regular filesystem files—such as creating empty swapfiles, zeroing out drives, or writing ISO images directly to USB disks. We use dd (dataset definition).

- dd if= of= bs= count= clones raw blocks.
- E.g. dd if=/dev/zero of=disk.img bs=1M count=1 creates a 1MB dummy disk file filled with null bytes.
- When automation scripts require scratch files without race conditions or overwriting existing user data, mktemp creates uniquely named files under /tmp.

Let's create a block device file and generate a scratch file. Create a 1MB zero-filled disk image named disk.img by running dd if=/dev/zero of=disk.img bs=1M count=1. Then, generate a safe temporary file using mktemp.

Référence de syntaxe des commandes

Command / SyntaxDescription
dd if=/dev/zero of=disk.img bs=1M count=1Create 1MB disk image using dd
mktempGenerate unique temporary file in /tmp

Objectifs de vérification

  • ○
    Create disk.img using dd
  • ○
    Create temporary file with mktemp

Prêt à terminer la Quête 131?