Disk and tape drive commands

From LQWiki
Jump to navigation Jump to search


  • cfdisk - Interactive hard disc partition utility for text mode.
  • fdisk - Launches a menu-driven program that partitions a hard disk.
  • parted - command line partitioning tool. (parted sometimes complains about boundaries of partitions created with fdisk. parted can format a partition of type ext2 or fat32 partition while creating it.)


  • mkfs - front-end to various filesystem-creation tools
    • parted can create a filesystem while partitioning
    • mkfs.vfat /dev/sde1 to format a fat32 partition sde1
    • mkfs.ext2 /dev/sde2 to format an ext2 partition sde2


  • tune2fs - command to tune ext2/ext3 filesystems
    • tune2fs -j /dev/sde2 to convert an ext2 filesystem sde2 to ext3 by adding a journal
    • tune2fs -L /dev/sde2 bulkdata to set the volume label of sde2 to "bulkdata"
  • debugfs - Interactive utility to repair the ext2 filesystem on specified drive.
  • e2fsck- Performs an analysis of the filesystem's integrity and optionally repairs errors.
  • badblocks - Scans the specified drive for bad blocks.

Using a configured hard drive or tape

  • df - Displays the amount of disc space used and remaining on all mounted filesystems.
  • hwinfo - Automatically recognizes all available CD-ROM drives.
  • mount - Attaches the device to a specified directory, which will serve as the filesystem's mount point.
  • sync - Flushes the filesystem buffers.
  • umount - Unmounts the filesystem specified by the device.
  • du - Displays the amount of disc space used in the current directory.
    • duchs - Lists the largest directories in human readable format
  • eject - Ejects the media in the specified drive.


  • mc (midnight commander) - Command line file manager. Can undelete files in unmounted ext2 filesystems.


  • partimage - Backs up disk partitions into image files and restores them.

Logical Volume Management

See LVM.