In this learning path I will go into all the options the Command Prompt has to offer. I know it looks like DOS has returned to life but it has a lot of great options and can be incredibly powerful when used correctly. In this part I will learn you how to check your drive for error’s (and fix them) and we will also loot at the format options the Command Prompt has to offer.
Learning: Format External Drive or run Check Disk using the Command Prompt
There are times when for whatever reason your computer isn’t able to connect to your external drive. There are two ways to fix this, you can let windows check for errors that might have occur on the drive or you could simple format the drive in order to restore it. As formatting a drive should only be the last resort option, we will start by checking the drive for errors. This wouldn’t only work on an external drive, but can also be used to fix error’s you might have one your main disk.
CHKDSK [drive:][[path]filename] [/F] [/V] [/R] [/L[:size]]
[drive:] The drive to check. filename File(s) to check for fragmentation (FAT only). /F Automatically Fix file system errors on the disk. /X Fix file system errors on the disk, (Win2003 and above) dismounts the volume first, closing all open file handles. /R Scan for and attempt Recovery of bad sectors. /V Display the full path and name of every file on the disk. /L:size NTFS only: change the log file size to the specified number of kilobytes. If size is not specified, displays the current log size and the drive type (FAT or NTFS). /C Skip directory corruption checks. /I Skip corruption checks that compare directory entries to the file record segment (FRS) in the volume's master file table (MFT)
Run Check Disk using the Command Prompt
Open to command prompt in windows as administrator and type the following:
chkdsk /f /r /x E:
CHKDSK is the main command for the check disk. We added /F to automatically fix file system errors, /R to scan for and attempt to recovery of bad sectors and /X to fix the file system errors on the disk. Please make sure you don’t add /X to the command if you want to check your running disk for errors as it will dismount to volume first. You will have to run Windows in recovery CMD mode if you want to do that.
The E: is the letter of the external drive I would like CMD to scan for errors and repair the errors if found. Please make sure you replace it with the correct letter for the drive you want windows to scan.
The Check Disk operation will start on the drive, and it will also repair any errors which may be found.
Format a drive using the Command Prompt
For formating a drive you can also use the graphical interface Windows gives you, so why would you use CMD for it? Simple, using CMD will be faster and gives better results. And if that isn’t enough, it looks cool and makes people around you think you are really smart.
FORMAT drive: [/FS:file-system] [/V:label] [/Q] [size] [/C]
/FS:file-system The file system (FAT or NTFS). The NTFS file system does not function on floppy disks. /V:label The volume label. /Q Quick format. /C Compression - files added to the new disk will be compressed. /A:Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. If you do not specify UnitSize, it is chosen based on volume size. Default settings are strongly recommended for general use. The following list presents valid values for NTFS, FAT, and FAT32 UnitSize: NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K. FAT supports 8192, 16K, 32K, 64K, 128K, 256K. NTFS compression is not supported for allocation units above 4096.
Using the formatting command[alert-warning]Please make sure you are entering the correct driveletter, as using a wrong one can make your installation unstable and could result in the lost of important files. Adding extra options to the command are only advised to be used by people who know what they are doing. If you are not 100% sure, just use the default settings, if will be enough to format the drive and make it feel like it’s brand new. [/alert-warning]
To format a drive using CMD you just enter
format E: /fs:ntfs