磁盘管理命令
Windows虽然是图形界面,但也有强大的MSDOS管理命令:diskpart供使用。diskpart磁盘管理模块可以完成在“Disk Management”下面的所有操作。
Diskpart命令如图2-6所示。
在此,列出利用diskpart模块对映射的3个LUN执行初始化等一系列操作后称为可用的RAID-5卷的过程。
- 扫LUN操作。
DISKPART> rescan Please wait while DiskPart scans your configuration... DiskPart has finished scanning your configuration. DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 279 GB 0 B Disk 1 Online 279 GB 4094 MB Disk 2 Offline 5120 MB 5120 MB Disk 3 Offline 10 GB 0 B * Disk 4 Offline 20 GB 0 B *
- 使第一次映射的LUN online。
DISKPART> select disk 2 Disk 2 is now the selected disk. DISKPART> online disk DiskPart successfully onlined the selected disk. DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 279 GB 0 B Disk 1 Online 279 GB 4094 MB * Disk 2 Online 5120 MB 5120 MB Disk 3 Offline 10 GB 0 B * Disk 4 Offline 20 GB 0 B * DISKPART> select disk 3 Disk 3 is now the selected disk. DISKPART> online disk DiskPart successfully onlined the selected disk. DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 279 GB 0 B Disk 1 Online 279 GB 4094 MB Disk 2 Online 5120 MB 5120 MB * Disk 3 Online 10 GB 0 B * Disk 4 Offline 20 GB 0 B * DISKPART> select disk 4 Disk 4 is now the selected disk. DISKPART> online disk DiskPart successfully onlined the selected disk. DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 279 GB 0 B Disk 1 Online 279 GB 4094 MB Disk 2 Online 5120 MB 5120 MB Disk 3 Online 10 GB 0 B * * Disk 4 Online 20 GB 0 B *
- 更改磁盘状态为动态磁盘。
DISKPART> select disk 2 Disk 2 is now the selected disk. DISKPART> convert dynamic DiskPart successfully converted the selected disk to dynamic format. DISKPART> select disk 3 Disk 3 is now the selected disk. DISKPART> convert dynamic DiskPart successfully converted the selected disk to dynamic format. DISKPART> select disk 4 Disk 4 is now the selected disk. DISKPART> convert dynamic DiskPart successfully converted the selected disk to dynamic format.
- 创建RAID-5卷。
DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 System Rese NTFS Partition 350 MB Healthy System Volume 1 C NTFS Partition 160 GB Healthy Boot DISKPART> create volume raid size=50 disk=2,3,4 DiskPart successfully created the volume. DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 System Rese NTFS Partition 350 MB Healthy System Volume 1 C NTFS Partition 160 GB Healthy Boot * Volume 2 RAW RAID-5 100 MB Healthy
- 格式化卷。
DISKPART> format 100 percent completed DiskPart successfully formatted the volume. DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 System Rese NTFS Partition 350 MB Healthy System Volume 1 C NTFS Partition 160 GB Healthy Boot * Volume 2 NTFS RAID-5 100 MB Healthy
- 挂载文件系统。
DISKPART> assign DiskPart successfully assigned the drive letter or mount point. DISKPART> list volume Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 System Rese NTFS Partition 350 MB Healthy System Volume 1 C NTFS Partition 160 GB Healthy Boot * Volume 2 D NTFS RAID-5 100 MB Healthy
说明:
Windows下面的命令管理磁盘虽然没有图形化管理便捷,但是在自动化管理和测试是十分有用的。