dd命令功能很強大的,對於一些比較底層的問題,使用dd命令往往可以得到出人意料的效果。用的比較多的還是用dd來備份裸裝置。但是不推薦,如果需要備份oracle裸裝置,可以使用rman備份,或使用第三方軟體備份,使用dd的話,管理起來不太方便。
建議在有需要的時候使用dd 對物理磁碟操作,如果是檔案系統的話還是使用tar backup cpio等其他命令更加方便。
另外,使用dd對磁碟操作時,最好使用塊裝置檔案。
Description
The dd command reads the InFile parameter or standard input, does the
specified conversions, then copies the converted data to the OutFile
parameter or standard output. The input and output block size can be
specified to take advantage of raw physical I/O. Note: The term Block
refers to the quantity of data read or written by the dd command in one
operation and is not necessarily the same size as a disk block.
if=file 輸入檔案名稱 標準輸入確省
of=file 輸出檔案名,標準輸出確省
ibs=n 輸入塊大小,n位元組(預設512)
obs=n 輸出塊大小,n位元組(預設512)
bs=n 同時設定輸入輸出塊大小
cbs=n 轉換緩衝區大小
files=n 在中斷之前拷貝和轉換n個輸入檔案
skip=n 拷貝之前越過n個輸入塊
oseek=n 拷貝之前從輸出檔案開始尋找n個塊
iseek 拷貝之前從輸入檔案開始尋找n個塊
seek=n 等同於oseek
cono=ascic 將EBCDIC碼轉換為ASCII
ebcdic ASCII->;EBCDIC
ibm ASCII轉換為EBCDIC碼時輕微不同的映象
blolk 將新棧中斷的ASCII碼記錄轉換為固定長度
unblock 將固定長度的ASCII碼記錄轉換為新行中斷記錄
lcase 變換字將至低等情況
ucase 變換字將至高等情況
swab 交換每對位元組
noerrir 出錯時不停止處理
sync 將每個塊填充到ibs
輸入裝置:infile參數指定或標準輸入
實施指定的轉換,然後複製轉換資料到 outfile 參數指定或標準輸出。
輸入塊和輸出塊大小可以自己指定,但必須是磁碟物理塊大小的倍數。
1
Usually, you need only write access to the output file. However,
when the output file is not on a direct-access device and you use
the seek flag, you also need read access to the file.
2
The dd command inserts new-line characters only when converting
with the conv=ascii or conv=unblock flags set; it pads only when
converting with the conv=ebcdic, conv=ibm, or conv=block flags
set.