适用于: Windows Server (半年通道) ,Windows Server 2019,Windows Server 2016,Windows Server 2012 R2,Windows Server 2012Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

显示或设置操作系统的存储区域网络 (san) 策略。Displays or sets the storage area network (san) policy for the operating system. 如果不使用参数,则显示当前 san 策略。If used without parameters, the current san policy is displayed.


san [policy={onlineAll | offlineAll | offlineShared}] [noerr]


参数Parameter 说明Description
policy = {onlineAllpolicy={onlineAll offlineAllofflineAll offlineShared}]offlineShared}] 为当前启动的操作系统设置 san 策略。Sets the san policy for the currently booted operating system. San 策略确定新发现的磁盘是处于联机状态还是脱机状态,以及它是读写还是只读。The san policy determines whether a newly discovered disk is brought online or remains offline, and whether it becomes read/write or remains read-only. 磁盘脱机时,可以读取磁盘布局,但不会通过即插即用来显示卷设备。When a disk is offline, the disk layout can be read, but no volume devices are surfaced through Plug and Play. 这意味着不能在磁盘上装载文件系统。This means that no file system can be mounted on the disk. 磁盘联机时,将为该磁盘安装一个或多个卷设备。When a disk is online, one or more volume devices are installed for the disk. 下面是每个参数的说明:The following is an explanation of each parameter:
  • onlineAllonlineAll. 指定所有新发现的磁盘都将联机并进行读/写。Specifies that all newly discovered disks will be brought online and made read/write. 重要提示: 在共享磁盘的服务器上指定 onlineAll 可能会导致数据损坏。IMPORTANT: Specifying onlineAll on a server that shares disks could lead to data corruption. 因此,如果磁盘在服务器之间共享,则不应设置此策略,除非该服务器是群集的一部分。Therefore, you should not set this policy if disks are shared among servers unless the server is part of a cluster.
  • offlineAllofflineAll. 指定除启动磁盘之外的所有新发现的磁盘在默认情况下都是脱机和只读的。Specifies that all newly discovered disks except the startup disk will be offline and read-only by default.
  • offlineSharedofflineShared. 指定所有未驻留在共享总线上的新发现磁盘 (如 SCSI 和 iSCSI) 会联机并进行读写。Specifies that all newly discovered disks that do not reside on a shared bus (such as SCSI and iSCSI) are brought online and made read-write. 默认情况下,处于脱机状态的磁盘将为只读。Disks that are left offline will be read-only by default.
有关详细信息,请参阅 VDS_san_POLICY 枚举For more information, see VDS_san_POLICY Enumeration.
noerrnoerr 仅用于脚本编写。Used for scripting only. 出现错误时,DiskPart 继续处理命令,就像未发生错误一样。When an error is encountered, DiskPart continues to process commands as if the error did not occur. 如果没有此参数,则错误会导致 DiskPart 退出并出现错误代码。Without this parameter, an error causes DiskPart to exit with an error code.


若要查看当前策略,请键入:To view the current policy, type:


若要使所有新发现的磁盘(启动磁盘除外、脱机且默认情况下为只读),请键入:To make all newly discovered disks, except the startup disk, offline and read-only by default, type:

san policy=offlineAll

其他参考Additional References