Disk Management Commands


Diskpart Command

  • diskpart is command interface underlying the Disk Management tool
  • many commands included
  • To inspect disks and partitions:
    • diskpart to run the utility
    • select disk 0 to select a disk by its number
    • detail disk to display config info for the disk
    • select partition 0 or select volume 0 to check partition/volume
    • detail partition/volume
      • assign to change drive letter
      • delete to destroy the volume
      • extend to extend the size
    • exit to exit

Format Command

  • format writes a new file system to a drive
  • deletes existing data on the drive
  • format X:/fs:SYS where SYS is the file system type (NTFS, FAT32, etc.)
  • /q suppresses scan for bad sectors
    • scans by default without this

chkdsk Command

  • chkdsk scans the file system and/or disk sectors for faults and can attempt to repair and problems
    • autochk uns at boot and does this automatically
  • 3 ways to run the tool
    • chkdsk X: with drive letter runs in read-only mode
      • reports whether errors need to be repaired
    • chkdsk X: /f attempts to fix system errors
    • chkdsk X: /r fixes file system errors and attempts recovery of bad sectors
      • recoverable data is copied to root dir as filennn.chk files
  • can take a long time to run, cancelling scan is not recommended