IT tutorials
 
Windows
 

Using Windows Home Server’s Command-Line Tools : Working with the Command-Line Tools (part 1) - Working with Disk Management Tools

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
5/29/2013 7:29:43 PM

The real power of the command line shines through when you combine the techniques you’ve learned so far with any of Windows Home Server’s dozens of command-line tools.

1. Working with Disk Management Tools

Windows Home Server comes with a large collection of command-line disk management tools that enable you to check disks or partitions for errors, as well as defragment, format, partition, and convert disks. Table 1 lists the disk management tools that you can use with Windows Home Server.

Table 1. Windows Home Server’s Command-Line Disk Management Tools
ToolDescription
CHKDSKChecks a specified volume for errors.
CHKNTFSConfigures automatic disk checking.
CONVERTConverts a specified volume to a different file system.
DEFRAGDefragments a specified volume.
DISKCOMPCompares the contents of two floppy disks. (This tool does not compare hard disks or other types of removable media, such as memory cards.)
DISKCOPYCopies the contents of one floppy disk to another. (This tool does not copy hard disks or other types of removable media, such as memory cards.)
DISKPARTEnables you to list, create, select, delete, and extend disk partitions.
EXPANDExtracts one or more files from a compressed file, such as a .cab file found on some installation discs.
FORMATFormats the specified volume.
FSUTILPerforms a number of file system tasks.
LABELChanges or deletes the name of a specified volume.
MOUNTVOLCreates, displays, or deletes a mount point.
VOLDisplays the name and serial number of a specified volume.

Note

In this section, I’ll use the word volume to refer to any disk, partition, or mount point.


The next four sections give you more detailed coverage of the CHKDKS and CHKNTFS tools.

CHKDSK: Checking for Hard Disk Errors
Here’s the syntax for CHKDSK:
CHKDSK [volume [filename]] [/F] [/V] [/R] [/X] [/I] [/C] [/B] [/L:[size]]

volumeThe drive letter (followed by a colon) or mount point.
filenameOn FAT16 and FAT32 disks, the name of the file to check for errors. Include the path if the file isn’t in the current folder.
/FTells CHKDSK to automatically fix errors. This is the same as running the Check Disk GUI with the Automatically Fix File System Errors option activated.
/VRuns CHKDSK in verbose mode. On FAT16 and FAT32 drives, CHKDSK displays the path and name of every file on the disk; on NTFS drives, CHKDSK displays cleanup messages, if any.
/RTells CHKDSK to scan the disk surface for bad sectors and recover data from the bad sectors, if possible. (The /F switch is implied.) This is the same as running the Check Disk GUI with the Scan for and Attempt Recovery of Bad Sectors option activated.
/XOn NTFS nonsystem disks that have open files, forces the volume to dismount, invalidates the open file handles, and then runs the scan. (The /F switch is implied.)
/IOn NTFS disks, tells CHKDSK to check only the file system’s index entries.
/COn NTFS disks, tells CHKDSK to skip the checking of cycles within the folder structure. This is a rare error, so using /C to skip the cycle check can speed up the disk check.
/BOn NTFS disks, tells CHKDSK to recheck bad clusters. (The /R switch is implied.)
/L:[size]On NTFS disks, tells CHKDSK to set the size of its log file to the specified number of kilobytes. The default size is 65,536, which is big enough for most systems, so you should never need to change the size. Note that if you include this switch without the size parameter, Check Disk tells you the current size of the log file.

For example, to run a read-only check—that is, a check that doesn’t repair errors—on drive C:, you enter the following command:

chkdsk c:

Note that when you use the /F switch to fix errors, CHKDSK must lock the volume to prevent running processes from using the volume during the check. If you use the /F switch on drive C:, which is the Windows Home Server system drive, CHKDSK can’t lock the drive, and you see the following message:

Cannot lock current drive.

Chkdsk cannot run because the volume is in use by another
process. Would you like to schedule this volume to be
checked the next time the system restarts? (Y/N)

If you press Y and Enter, CHKDSK schedules a check for drive C: to run the next time you reboot Windows Home Server.

CHKNTFS: Scheduling Automatic Disk Checks

You saw in the previous section that CHKDSK prompts you to schedule an automatic disk check during the next reboot if you run CHKDSK /F on the system drive (drive C: in Windows Home Server). If you press Y and Enter at this prompt, CHKDSK adds the AUTOCHK utility to the following Registry setting:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\BootExecute

This setting specifies the programs that Windows Home Server should run at boot time when the Session Manager is loading. AUTOCHK is the automatic version of CHKDSK that runs at system startup.

Windows Home Server also comes with a command-line tool named CHKNTFS that enables you to cancel pending automatic disk checks, schedule boot-time disk checks without using CHKDSK, and set the time that AUTOCHK counts down before running the automatic disk checks.

Here’s the syntax for CHKNTFS:

CHKNTFS [volume ][/C volume:] [/X volume:] [/D] [/T:[time]]

volumeA drive letter (followed by a colon) or mount point.
/C volumeTells CHKNTFS to schedule an automatic startup disk check for the specified volume. You can specify multiple volumes (separated by spaces).
/X volumeTells CHKNTFS to exclude the specified volume from an automatic startup disk check. You can specify multiple volumes (separated by spaces).
/DTells CHKNTFS to exclude all volumes from an automatic startup disk check.
/T:[time]Specifies the time that AUTOCHK counts down before starting the automatic disk checks.

When you run CHKNTFS with just a volume name, you see one of the following:

  • If the volume is not scheduled for a startup disk check, you see the volume’s file system:

    The type of the file system is NTFS.
  • If the volume is scheduled for a startup disk check, you see the following message:

    Chkdsk has been scheduled manually to run on next reboot.
  • If Windows Home Server’s Storage Manager has detected an error on the volume, it marks the volume as dirty, so in this case, you see the following message (using drive C: as an example):

    C: is dirty. You may use the /C option to schedule chkdsk for this drive.

This last message is confusing because Windows Home Server always performs an automatic startup disk check of any volume that’s marked as dirty. What you can do with CHKNTFS is bypass the automatic startup disk check of any volume that is marked as dirty. To do that, run CHKNTFS with the /X switch, as in this example:

chkntfs /x c:

Note

To manually mark a volume as dirty, use the FSUTIL DIRTY SET volume command, where volume is the drive you want to work with. For example, the following command marks drive C: as dirty:

fsutil dirty set c:

If you’re not sure whether a drive is dirty, either run CHKNTFS volume or run FSUTIL DIRTY QUERY volume, as in this example:

fsutil dirty query c:

Note, however, that FSUTIL doesn’t give you a way to unmark a drive as dirty.


If a volume isn’t already marked as dirty, you can force CHKDSK to check a volume at startup by running CHKNTFS with the /C switch. For example, the following command sets up an automatic start check for drive C:

chkntfs /c c:

Note that the /C switch is cumulative, meaning that if you run it multiple times and specify a different volume each time, CHKNTFS adds each new volume to the list of volumes to check at startup. Instead of running multiple commands, however, you can specify multiple volumes in a single command, like so:

chkntfs /c c: t: w:

If you know that a volume has been scheduled for a startup check, but you want to cancel that check, run CHKNTFS with the /X switch, as in this example:

chkntfs /x c:

If you know that multiple volumes are scheduled for automatic startup checks, you can cancel all the checks by running CHKNTFS with the /D switch:

chkntfs /d

If you’ve scheduled a startup check for one or more volumes, or if a volume is marked as dirty, the next time you reboot Windows Home Server, you see a message similar to the following (which uses drive C: as an example):

Checking file system on C:
The type of the file system is NTFS.
Volume label is SYS.

One of your disks needs to be checked for consistency. You
may cancel the disk check, but it is strongly recommended
that you continue.
To skip disk checking, press any key within 10 second(s).

The number of seconds in the last line counts down to 0. If you press a key before the countdown ends, Windows Home Server skips the disk check; otherwise, it continues with CHKDSK.

Caution

Pressing any key to skip the disk check usually only works with wired keyboards. On most wireless keyboards, pressing a key has no effect.


You can change the initial countdown value by running CHKNTFS with the /T switch, followed by the number of seconds you want to use for the countdown. For example, the following command sets the countdown to 30 seconds:

chkntfs /t:30

Note that if you run the command CHKNTFS /T (that is, you don’t specify a countdown value), CHKNTFS returns the current countdown value.

 
Others
 
- Windows 8 : Security - Action Center
- Windows 8 : Security - Windows Defender
- Windows Vista : Exploring Expert File and Folder Techniques - Customizing Windows Explorer
- Windows Vista : Exploring Expert File and Folder Techniques - Shadow Copies and Transactional NTFS
- Windows Vista : Exploring Expert File and Folder Techniques - Grouping, Stacking, and Filtering with Metadata
- Windows 7 : Troubleshooting Your Internet Connection (part 5)
- Windows 7 : Troubleshooting Your Internet Connection (part 4) - Identifying Network Hardware Problems
- Windows 7 : Troubleshooting Your Internet Connection (part 3) - Identifying Software Configuration Problems
- Windows 7 : Troubleshooting Your Internet Connection (part 2) - Troubleshooting Step by Step
- Windows 7 : Troubleshooting Your Internet Connection (part 1) - Before You Run into Trouble
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us