This paper provides a step-by-step guide on how to partition a hard drive from the command line, allowing users to resize, move, extend, and shrink volumes without losing any data. Additionally, it covers how to create, format, and delete partitions using command line prompts.
How to Use Qiling Disk Master Command Lines?
Qiling Disk Master Professional DiskMasterX.exe is a command line utility that allows users to partition their hard drive from the command prompt, offering more power than Diskpart. It enables users to perform most disk partition operations that are supported by the Qiling Disk Master GUI, providing a flexible and efficient way to manage disk partitions.
You can resize, move, extend, or shrink a partition without data loss from the command prompt using the DiskMasterX.exe command, which also supports additional operations like creating, deleting, or formatting a partition, as well as rebuilding the Master Boot Record (MBR).
To use DiskMasterX.exe, go to the Start menu, type "cmd" in the search box, and run it as administrator. In the Command Prompt, type "cd" followed by the installation directory of Qiling Disk Master (e.g. "cd C:\Program Files (x86)\Qiling Disk Master").
Here are some features of Qiling Disk Master command line in one paragraph:
Export Execution Results to File
Because this command execution cannot use the ">" symbol to export execution results to file, we add a "/out" parameter to export execution results to file, allowing all command lines to be exported to a file.
Extend a partition to utilize unallocated space on both sides and align it for optimal read/write performance.
DiskMasterX.exe /resize:F /extend:auto /align
DiskMasterX.exe /hd:0 /resize:0 /extend:right
To extend a specified partition using the unallocated space on its right side, you can use a disk management tool to resize the partition and utilize the adjacent free space. This process typically involves selecting the partition you want to extend, choosing the unallocated space to the right, and then confirming the operation to resize the partition and make use of the available space.
Use a partition manager tool to extend the specified partition by taking the unallocated space on its left side, and align it to optimize reading/writing speed.
DiskMasterX.exe /resize:F /extend:left /align
DiskMasterX.exe /hd:0 /resize:0 /extend:1000
Extend a partition by using 1000MB or 10GB of unallocated space on its right side.
To create 1000MB or 10GB unallocated space on the right side of a specified partition, you can use the `resize2fs` command in Linux. First, identify the device and partition you want to modify, then use `resize2fs` to shrink the partition to the desired size.
To optimize reading/writing speed, shrink a specified partition to create 1000MB or 10GB of unallocated space on its left side and align the partition. This process involves resizing the partition to make space for a new drive or to improve performance by optimizing the partition's alignment.
"/hd" followed by disk number, which starts with 0.
The command "/resize" is used to resize a partition, and it requires a partition number or drive letter. The partition number starts with 0. If a drive letter is specified, the disk number can be ignored.
The value of "/extend" can be "left", "right", "auto", or a specified size.
"/align" in partition resizing means it optimizes reading/writing speed by adjusting the partition's start point when its size changes, but it's only effective when the start point is actually moved. If the start point remains the same, the optimization doesn't occur.
The specified size can be in either MB or GB, depending on the default setting.
Move a Partition without Data Loss
Parameters
Description
DiskMasterX.exe /hd:0 /move:0 /left:1000 /align
To optimize reading/writing speed, move the partition 1000MB or 10GB to the left side and align it. This involves resizing the partition to shift its starting point to the left, effectively making the most frequently accessed data (usually at the beginning of the drive) closer to the read/write heads, which should improve performance.
DiskMasterX.exe /move:F /left:10GB /align
DiskMasterX.exe /hd:0 /move:0 /left:auto /align
Move a partition to occupy all unallocated space on its left and align it to optimize reading/writing speed.
DiskMasterX.exe /move:F /left:auto /align
DiskMasterX.exe /hd:0 /move:0 /right:1000 /align
To optimize partition alignment and increase reading/writing speed, move the partition 1000MB or 10GB to the right side, effectively shifting its location to improve disk performance. This adjustment ensures that the partition is properly aligned, which can lead to better data access and transfer rates.
DiskMasterX.exe /move:F /right:10GB /align
DiskMasterX.exe /hd:0 /move:0 /right:auto /align
Move a partition to occupy all unallocated space on its right side and align it to optimize reading/writing speed.
DiskMasterX.exe /move:F /right:auto /align
Notes:
"/hd" followed by disk number, which starts with 0.
The command "/move" is used to move a partition or drive letter to a new location, and the partition number starts with 0. If the specified value is a drive letter, the disk number can be ignored.
The value of "/left" can be auto or specified size.
The value of "/right" can be auto or specified size.
"/align" means creating aligned partition to optimize reading/writing speed.
The specified size can be in either MB or GB by default.
Create a New Partition
Parameters
Description
DiskMasterX.exe /hd:1 /cre /pri /size:200 /end /fs:fat16 /act /hide /align /label:EFI. This can be rewritten as: Run DiskMasterX with the following parameters: create a new partition on hard disk 1, set the partition as primary, set the partition size to 200, set the end of the partition, use the FAT16 file system, make the partition active, hide the partition, align the partition, and label the partition as EFI.
Create a 200MB, 10GB or auto size partition at the end of a disk.
The command DiskMasterX.exe is used to manage a disk with specific settings. It is executed on drive 1, creates a new partition, sets the priority, allocates 10GB of space, marks the end of the partition, formats the disk with the FAT32 file system, activates the partition, hides it from view, aligns the partition, and labels it as "EFI".
The command `DiskMasterX.exe /hd:1 /cre /pri /size:auto /end /fs:ntfs /act /hide /align /label:EFI` is a command-line instruction that utilizes the DiskMasterX tool to create a new hard disk partition. The command creates a new partition on the first hard disk (`/hd:1`), sets it as the primary partition (`/pri`), and assigns it a size of auto (`/size:auto`).
The command to create an auto-size or 500MB partition using the first block of unallocated space on a disk is `fdisk /dev/sda` followed by `n`, `p`, `1`, and `500M` in the terminal. This command will open the fdisk utility, allow you to create a new partition, specify the partition number, and set the partition size to 500MB, respectively.
The command DiskMasterX.exe is used to manipulate a disk, specifically drive 0, with various options. It creates a new partition ( /cre ) with a primary partition ( /pri ) and sets the partition size to automatic ( /size:auto ), with an offset of 100 ( /offset:100 ).
To create a partition using offset, you can use the `parted` command in Linux. Here's how to create a partition at 100MB and 100GB offsets: `parted /dev/sda mkpart primary 100MB 100GB` This command creates a new partition named "primary" on the device "/dev/sda" starting from the 100MB offset and ending at the 100GB offset. The `mkpart` command is used to create a new partition, and the `primary` argument specifies that this is a primary partition.
The command is a batch instruction for DiskMasterX, a disk management tool. It creates a new partition on the first hard drive (hd:0), making it a primary partition (pri), with a size of 10GB and offset of 100GB, formatted with the FAT32 file system, and labeled as "DATA" with the drive letter "F". The command also enables alignment and activation of the partition.
Notes:
"/hd" followed by disk number, which starts with 0.
The value of "/size" can be set to "auto" or a specified size in MB or GB.
The term "/fs" refers to the file system, which can have values such as fat16, fat32, or ntfs.
"/pri" means creating a primary partition.
"/end" is an option in disk management tools that creates a specified size back end partition using the unallocated space at the end of a disk.
"/act" means creating an active partition.
"/hide" means creating a hidden partition.
The "/letter" option in Windows allows you to assign a drive letter to a partition, and "/letter:auto" can automatically assign the drive letter.
"offset" in partitioning means creating a partition from the specified offset, starting from the beginning of the disk.
"/hd" followed by disk number, which starts with 0.
The format command "/fmt" is used to format a partition or drive, and it requires a partition number or drive letter. The partition number starts with 0. If the specified value is a drive letter, the disk number can be ignored.
"fs" in this context refers to the file system type, which can be one of the following: fat16, fat32, or ntfs.
Delete a Partition
Parameters
Description
DiskMasterX.exe /hd:0 /del:0
Delete a specified partition.
DiskMasterX.exe /del:F
DiskMasterX.exe /hd:0 /del:all
Delete all the partitions on a disk.
Hide/Unhide a Partition
Parameters
Description
DiskMasterX.exe /hd:0 /hide:0
Hide a specified partition.
DiskMasterX.exe /hide:F
DiskMasterX.exe /hd:0 /unhide:0
Unhide a specified partition.
Mark a Partition as Active
Parameters
Description
DiskMasterX.exe /setact:1 /hd:0
Set a specified partition as active.
DiskMasterX.exe /setact:F
Initialize a Disk
Parameters
Description
DiskMasterX.exe /init:1
Initialize a disk as MBR.
DiskMasterX.exe /init:1 /gpt
Initialize a disk as GPT.
Rebuild MBR
Parameters
Description
DiskMasterX.exe /rebuildmbr:0
To rebuild the master boot record (MBR) for a hard disk, removable disk, or USB flash drive, follow these steps: Boot from a Windows installation media or a Linux live CD/USB. Open a command prompt or terminal and type the command "bootrec /fixmbr" and press Enter.
DiskMasterX.exe /rebuildmbr:0 /mbrtype:0
DiskMasterX.exe /rebuildmbr:0 /mbrtype:1
DiskMasterX.exe /rebuildmbr:0 /mbrtype:2
Notes:
"/rebuildmbr" followed by disk number, which starts with 0.
The "/mbrtype" option supports a specified MBR type, with values 0, 1, and 2, indicating the creation of MBR types for Windows XP/2000/2003, Windows Vista/2008, and Windows 7/8/8.1/10/2012/2013 respectively.
If the value of /mbrtype is not specified, the default type is the same as the current system, so if the system is Windows XP, the default is 0, and if it's Windows 8.1, the default is 2.
Change Drive Letter
Parameters
Description
DiskMasterX.exe /hd:0 /setletter:0 /letter:*
Remove drive letter.
DiskMasterX.exe /hd:0 /setletter:0 /letter:F
Change drive letter to F.
Notes:
The commands "/hd" followed by disk number, "/setletter" followed by partition number, and the disk number and partition number always start with 0.
To remove a drive letter, you need to set the "/letter" value to * in the Windows Registry.
I won't remove or change the drive letter of the system partition. I will keep it as it is to ensure Windows boots properly.
If you use "/letter auto" to replace "/letter:F", the drive letter will be assigned automatically.
Write Files to a Hidden Partition
Parameters
Description
DiskMasterX.exe /hd:0 /whide:0 /src:C:\file.txt
To write files and folders to the root directory of a hidden partition, you can use the following command in the terminal: `sudo mkdir /media/username/partition_name && sudo mount /dev/sdXY /media/username/partition_name && sudo cd /media/username/partition_name && sudo mkdir test && sudo touch test.txt && sudo echo "Hello, World!
Before using the "/resize" and "/move" commands in Qiling Disk Master Command Line, it's recommended to run the Windows built-in chkdsk utility on the partition you want to resize, with the "/f" option to check and automatically fix any file system errors, ensuring data safety. For example, you can run "chkdsk.exe /f C:" on the C: drive.