Linux provides strong capabilities for handling storage devices, both physical (e.g., hard disks and USB drives) and virtual (e.g., RAID, LVM). This guide covers key command-line tools for common tasks such as mounting devices, formatting partitions, and creating CD-ROM images without deep system-level configuration.
mount
: Attach a file systemumount
: Detach a file systemfsck
: Check and repair file systemsfdisk
: Partition table manipulationmkfs
: Create a file systemdd
: Clone or convert datagenisoimage
: Build ISO 9660 fileswodim
: Burn data to optical mediamd5sum
: Verify data integrityMounting integrates a device into Linux's unified file system. Unlike Windows (C:, D:, etc.), Linux uses a single tree. The /etc/fstab
file defines mount points for system boot:
LABEL=/12 / ext4 defaults 1 1
LABEL=/home /home ext4 defaults 1 2
LABEL=/boot /boot ext4 defaults 1 2
Field | Description |
---|---|
Device | Name, label, or UUID (e.g., /dev/sda1) |
Mount Point | Where to attach device (e.g., /home) |
File System Type | e.g., ext4, ntfs, vfat, iso9660 |
Options | Mount flags (e.g., rw, ro) |
Frequency | Backup setting for dump |
Order | Check order for fsck |
mount
/dev/sda2 on / type ext4
/dev/sda5 on /home type ext4
/dev/sdb1 on /media/disk type vfat
sudo mkdir /mnt/cdrom
sudo mount -t iso9660 /dev/sdc /mnt/cdrom
cd /mnt/cdrom
ls
cd
umount /dev/sdc
If a device is in use (e.g., current working directory), umount
fails until released.
Linux uses RAM buffering for performance. Unmounting flushes writes and prevents data loss.
ls /dev
tail -f /var/log/messages
Example log when connecting USB:
sdb: sdb1
Attached SCSI removable disk
sudo mkdir /mnt/flash
sudo mount /dev/sdb1 /mnt/flash
df
sudo umount /dev/sdb1
sudo fdisk /dev/sdb
p
: Show partitionst
: Set type (e.g., 83 = Linux)w
: Write and exitq
: Quit without savingmkfs -t ext4 /dev/sdb1
mkfs -t vfat /dev/sdb1
umount /dev/sdb1
fsck /dev/sdb1
/dev/sdb1: clean, 11/3904 files, 1661/15608 blocks
dd if=/dev/sdb of=/dev/sdc
dd if=/dev/sdb of=flash_drive.img
dd if=/dev/cdrom of=ubuntu.iso
genisoimage -o cd-rom.iso -R -J ~/cd-rom-files
mkdir /mnt/iso_image
sudo mount -t iso9660 -o loop image.iso /mnt/iso_image
umount /mnt/iso_image
wodim dev=/dev/cdrw blank=fast
wodim dev=/dev/cdrw image.iso
md5sum image.iso
md5sum dvd-image.iso
dd if=/dev/dvd bs=2048 count=$(( $(stat -c "%s" dvd-image.iso) / 2048 ))
Tools like mount
, fdisk
, mkfs
, and dd
give Linux users deep control over storage media. Mastering these commands helps ensure safe device handling, efficient backups, and solid system management.