热门排行
简介
Linux下有一个dd工具,用来直接读写磁盘。
Windows下也有一个类似的工具,主要就是一个dd.exe文件。
打开Windows下的CMD命令行,进入到dd.exe所在的目录,通过dd /?可以查看命令说明:
C:\Users\Administrator\Desktop\os\os>dd.exe /?
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.Unknown command /?
dd [bs=SIZE] [count=BLOCKS] [if=FILE] [of=FILE] [seek=BLOCKS] [skip=BLOCKS] [--size] [--list] [--progress]
SIZE and BLOCKS may have one of the following suffix:
k = 1024
M = 1048576
G = 1073741824
default block size (bs) is 512 bytes
skip specifies the starting offset of the input file (if)
seek specifies the starting offset of the output file (of)
通过dd --list可以查看所有的磁盘:
C:\Users\Administrator\Desktop\os\os>dd --list
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by terms of the GPL Version 2.Win32 Available Volume Information
\\.\Volume{4102ffc6-797c-11e6-afa5-806e6f6e6963}\
link to \\?\Device\HarddiskVolume1
fixed media
Mounted on \\.\c:\\.\Volume{4102ffc8-797c-11e6-afa5-806e6f6e6963}\
link to \\?\Device\HarddiskVolume3
fixed media
Mounted on \\.\e:\\.\Volume{b1cc0dd3-5bf5-4b9f-b8ff-c791d9390873}\
link to \\?\Device\HarddiskVolume6
fixed media
Mounted on \\.\g:\\.\Volume{7441521c-0d1b-4d4e-906b-022bcf9a70cf}\
link to \\?\Device\HarddiskVolume7
fixed media
Mounted on \\.\h:\\.\Volume{4102ffc7-797c-11e6-afa5-806e6f6e6963}\
link to \\?\Device\HarddiskVolume2
fixed media
Mounted on \\.\d:\\.\Volume{4102ffc9-797c-11e6-afa5-806e6f6e6963}\
link to \\?\Device\HarddiskVolume4
fixed media
Mounted on \\.\f:
NT Block Device Objects
\\?\Device\Harddisk0\Partition0
link to \\?\Device\Harddisk0\DR0
Fixed hard disk media. Block size = 512
size is 250059350016 bytes
\\?\Device\Harddisk0\Partition1
link to \\?\Device\HarddiskVolume1
\\?\Device\Harddisk0\Partition2
link to \\?\Device\HarddiskVolume2
\\?\Device\Harddisk1\Partition0
link to \\?\Device\Harddisk1\DR1
Fixed hard disk media. Block size = 512
size is 2000398934016 bytes
\\?\Device\Harddisk1\Partition1
link to \\?\Device\HarddiskVolume3
Fixed hard disk media. Block size = 512
size is 107380998144 bytes
\\?\Device\Harddisk1\Partition2
link to \\?\Device\HarddiskVolume4
\\?\Device\Harddisk2\Partition0
link to \\?\Device\Harddisk2\DR2
Fixed hard disk media. Block size = 512
size is 4000787030016 bytes
\\?\Device\Harddisk2\Partition1
link to \\?\Device\HarddiskVolume5
Fixed hard disk media. Block size = 512
size is 134217728 bytes
\\?\Device\Harddisk2\Partition2
link to \\?\Device\HarddiskVolume6
Fixed hard disk media. Block size = 512
size is 2097152000000 bytes
\\?\Device\Harddisk2\Partition3
link to \\?\Device\HarddiskVolume7Virtual input devices
/dev/zero (null data)
/dev/random (pseudo-random data)
- (standard input)Virtual output devices
- (standard output)
/dev/null (discard the data)
前面部分是实际的磁盘,后面也有一些虚拟的磁盘,比如这里看到的/dev/zero。
要拷贝磁盘总的内容所用的命令跟Linux中的差不多,只是物理设备的名称稍微有点怪异。
下面是一些例子:
Make an image of a floppy disk:
dd if=\\.\a: of=c:\temp\disk1.img bs=1440k
Write the image back to a floppy disk:
dd if=c:\temp\disk1.img of=\\.\a: bs=1440k
Rip an .iso from a CD
dd if=\\?\Device\CdRom0 of=c:\temp\disc1.iso bs=1M
Read a partition from a USB memory device
dd if=\\.\Volume{c18588c0-02e9-11d8-853f-00902758442b} of=c:\temp\usb1.img bs=1M
Read the entire USB memory device
dd if=\\?\Device\Harddisk1\Partition0 of=c:\temp\usb2.img bs=1M --size --progress
You can write to any file or block device which windows will allow you to write to. You can use the standard \\.\ notation for win32 exported devices or the dd specific \\?\ notation to access windows native devices.
不过dd.exe似乎长久没有更新了,用起来也还有一些问题,需要谨慎使用。
说明
windows下非常好用的dd和grep工具,操作完全和linux一样
脚本之家已经打包了grep.exe与FloppyWriter.exe