Linux下使用dd命令製作啟動盤
阿新 • • 發佈:2018-12-13
1.檢視掛載的U盤的裝置名稱,一般按照大概的容量或者拔插前的區別來看。此處U盤裝置名為sdd1
╰─$ sudo fdisk -l 1 ↵ ... Disk /dev/sdd: 7.5 GiB, 8004304896 bytes, 15633408 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xf279747d 裝置 啟動 Start 末尾 扇區 Size Id 型別 /dev/sdd1 32 15633407 15633376 7.5G c W95 FAT32 (LBA)
2.如果U盤還在掛載狀態,解除安裝它。否則,會提示裝置或資源正忙。
umount /dev/sdd1
3.格式化U盤。
sudo mkfs.ntfs -f /dev/sdd1
4.寫入啟動引導。
sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sdd
5.將映象檔案寫入。其中 if 值為iso檔案路徑,of 值為要輸出到的裝置。
sudo dd if=/media/dts/000606BF00038C36/word/安裝光碟/作業系統/ubuntu_64.iso of=/dev/sdd1
如果想要看當前的進度和讀寫速度,可以另開一個終端,執行
sudo watch -n 5 killall -USR1 dd
即,對於dd命令,每5秒顯示一次進度。然後再回到之前的終端就可以看到每5秒一次的進度輸出了。
如下所示:
記錄了6378916+0 的讀入
記錄了6378916+0 的寫出
3266004992 bytes (3.3 GB, 3.0 GiB) copied, 734.875 s, 4.4 MB/s
注:僅能製作Linux啟動盤,如果想要製作windows,建議使用ultra ISO。
參考:
dd命令幫助
用法:dd [運算元] ... 或:dd 選項 Copy a file, converting and formatting according to the operands. bs=BYTES read and write up to BYTES bytes at a time cbs=BYTES convert BYTES bytes at a time conv=CONVS convert the file as per the comma separated symbol list count=N copy only N input blocks ibs=BYTES read up to BYTES bytes at a time (default: 512) if=FILE read from FILE instead of stdin iflag=FLAGS read as per the comma separated symbol list obs=BYTES write BYTES bytes at a time (default: 512) of=FILE write to FILE instead of stdout oflag=FLAGS write as per the comma separated symbol list seek=N skip N obs-sized blocks at start of output skip=N skip N ibs-sized blocks at start of input status=LEVEL The LEVEL of information to print to stderr; 'none' suppresses everything but error messages, 'noxfer' suppresses the final transfer statistics, 'progress' shows periodic transfer statistics N and BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y. Each CONV symbol may be: ascii from EBCDIC to ASCII ebcdic from ASCII to EBCDIC ibm from ASCII to alternate EBCDIC block pad newline-terminated records with spaces to cbs-size unblock replace trailing spaces in cbs-size records with newline lcase change upper case to lower case ucase change lower case to upper case sparse try to seek rather than write the output for NUL input blocks swab swap every pair of input bytes sync pad every input block with NULs to ibs-size; when used with block or unblock, pad with spaces rather than NULs excl fail if the output file already exists nocreat do not create the output file notrunc 不截斷輸出檔案 noerror 讀取資料發生錯誤後仍然繼續 fdatasync 結束前將輸出檔案資料寫入磁碟 fsync 類似上面,但是元資料也一同寫入 FLAG 符號可以是: append 追加模式(僅對輸出有意義;隱含了conv=notrunc) direct 使用直接I/O 存取模式 directory 除非是目錄,否則 directory 失敗 dsync 使用同步I/O 存取模式 sync 與上者類似,但同時也對元資料生效 fullblock 為輸入積累完整塊(僅iflag) nonblock 使用無阻塞I/O 存取模式 noatime 不更新存取時間 nocache Request to drop cache. See also oflag=sync noctty 不根據檔案指派控制終端 nofollow 不跟隨連結檔案 count_bytes treat 'count=N' as a byte count (iflag only) skip_bytes treat 'skip=N' as a byte count (iflag only) seek_bytes treat 'seek=N' as a byte count (oflag only) Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying. Options are: --help 顯示此幫助資訊並退出 --version 顯示版本資訊並退出 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 請向<http://translationproject.org/team/zh_CN.html> 報告dd 的翻譯錯誤 Full documentation at: <http://www.gnu.org/software/coreutils/dd> or available locally via: info '(coreutils) dd invocation'