使用 DiskPart 格式化 USB 磁盘产生“未选择卷”错误

使用 DiskPart 格式化 USB 磁盘产生“未选择卷”错误

我使用以下diskpart.exe顺序。我想指定磁盘编号,然后格式化磁盘。

C:\>diskpart

Microsoft DiskPart version 10.0.18362.1

Copyright (C) Microsoft Corporation.
On computer: AAAAAAA

DISKPART> select disk 2

Disk 2 is now the selected disk.

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> format fs=ntfs label="My USB Disk" quick

There is no volume selected.
Please select a volume and try again.

DISKPART>

正如您所看到的,该脚本应该可以工作,并且可能在Windows 7,因为在互联网上搜索到的几个页面都这么说,但在我的Windows 10安装中我得到了

未选择卷

文章不适用。作者确实忘记了create primary partition。同上这里

从该屏幕截图中您可以看到,磁盘 2 上确实有一个卷。

diskpart 显示单个卷

我的 USB 闪存驱动器只有一个卷,因此format应该可以工作。

有什么想法吗?

答案1

代码基本正确,但这里缺少一段。请根据需要进行修改。

create partition primary
select partition 1
active
format fs=ntfs label="My USB Disk" quick
assign letter=D

答案2

我遇到了同样的问题,记录显示,在重新启动后(它不会放开磁盘进行格式化)并在 CMD 而不是 Powershell 中尝试后,它就可以正常工作了。这有效:

  1. 运行CMD
  2. 输入“diskpart”并按回车键
  3. 在 diskpart 窗口中,输入“list disk”并按回车键
  4. 记下 USB 设备的磁盘编号,以便稍后使用
  5. 输入“sel dis 1”,将数字 1 改为步骤 4 中 USB 设备的编号。按回车键
  6. 输入“clean”并按回车键
  7. 输入“cre par pri size=30000”并按回车键
  8. 输入“sel par 1”并按回车键
  9. 输入“active”并按回车键
  10. 输入“format fs=fat32 quick”并按回车键
  11. 输入“assign”并按回车键
  12. 关闭 diskpart 和 CMD 窗口。

我正在尝试准备一个 50+GB 的 USB 记忆棒作为 <32GB 的 FAT32 分区启动设备。

答案3

我不知道我做了什么但它有效。

**

DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
  Disk 2    Online           29 GB    29 GB
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart has encountered an error: The device is not ready.
See the System Event Log for more information.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> active
There is no partition selected.
Please select a partition and try again.
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
* Disk 2    Online           29 GB      0 B
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> active
There is no partition selected.
Please select a partition and try again.
DISKPART> format fs=fat32 quick
There is no volume selected.
Please select a volume and try again.
DISKPART>
C:\WINDOWS\system32>diskpart
Microsoft DiskPart version 10.0.22000.653
Copyright (C) Microsoft Corporation.
On computer: ZMBBY
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
  Disk 2    Online           29 GB    29 GB
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> format fs=fat32 quick
There is no volume selected.
Please select a volume and try again.
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
  Disk 2    Online           29 GB    29 GB
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> create partition primary
Virtual Disk Service error:
The object is not found.
DISKPART>
C:\WINDOWS\system32>diskpart
Microsoft DiskPart version 10.0.22000.653
Copyright (C) Microsoft Corporation.
On computer: ZMBBY
DISKPART> list diskc
Microsoft DiskPart version 10.0.22000.653
DISK        - Display a list of disks. For example, LIST DISK.
PARTITION   - Display a list of partitions on the selected disk.
              For example, LIST PARTITION.
VOLUME      - Display a list of volumes. For example, LIST VOLUME.
VDISK       - Displays a list of virtual disks.
DISKPART> list dick
Microsoft DiskPart version 10.0.22000.653
DISK        - Display a list of disks. For example, LIST DISK.
PARTITION   - Display a list of partitions on the selected disk.
              For example, LIST PARTITION.
VOLUME      - Display a list of volumes. For example, LIST VOLUME.
VDISK       - Displays a list of virtual disks.
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
  Disk 2    Online           29 GB      0 B
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> create partition primary
Virtual Disk Service error:
The object is not found.
DISKPART> active
There is no partition selected.
Please select a partition and try again.
DISKPART> format fs=fat32 quick
There is no volume selected.
Please select a volume and try again.
DISKPART> create partition primary size=30000
No usable free extent could be found. It may be that there is insufficient
free space to create a partition at the specified size and offset. Specify
different size and offset values or don't specify either to create the
maximum sized partition. It may be that the disk is partitioned using the MBR disk
partitioning format and the disk contains either 4 primary partitions, (no
more partitions may be created), or 3 primary partitions and one extended
partition, (only logical drives may be created).
DISKPART> create partition primary
C:\WINDOWS\system32>diskpart
Microsoft DiskPart version 10.0.22000.653
Copyright (C) Microsoft Corporation.
On computer: ZMBBY
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          119 GB  1024 KB        *
  Disk 1    Online          931 GB   300 GB        *
  Disk 2    Online           29 GB      0 B
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> clean
DiskPart succeeded in cleaning the disk.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> format fs=fat32 quick
    0 percent completed
DiskPart has encountered an error: The request is not supported.
See the System Event Log for more information.
DISKPART> format fs=fat32 quick
  100 percent completed
DiskPart successfully formatted the volume.

**

答案4

嘿,音量没什么大不了的,你只需要选择驱动器,在我的情况下它是 H 驱动器,即第 8 个驱动器,所以我选择它并继续!

嘿,下面是我的 cmd 进程的图像,一定要检查一下

希望能帮助到你:
cmd进程映像

相关内容