Linux下使用dd命令制作启动盘


date: 2018-09-25 10:39:41+00:00
原标题: Linux下使用dd命令制作启动盘
原链接: https://www.dreamoftime0.com/2018/09/25/linux%e4%b8%8b%e4%bd%bf%e7%94%a8dd%e5%91%bd%e4%bb%a4%e5%88%b6%e4%bd%9c%e5%90%af%e5%8a%a8%e7%9b%98/

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'
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值