Arch-Linux

dd 不會創建可啟動的 Ubuntu iso

  • November 2, 2019

我執行dd以創建可啟動的 Ubuntu,但它不會使其可啟動。相反,它會立即返回,而不會像我看到的那樣創建任何東西。當我指向分區時,sda1它會向其中寫入數據,但 USB 不會啟動系統。也sudo fdisk -l沒有列出USB,但lsblk確實如此。如何製作可啟動的USB dd


[I] ➜ uname --all
Linux artpc 5.3.7-arch1-1-ARCH #1 SMP PREEMPT Fri Oct 18 00:17:03 UTC 2019 x86_64 GNU/Linux

~ 
[I] ➜ lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda             8:0    1  14.7G  0 disk  
└─sda1          8:1    1  14.7G  0 part  
nvme0n1       259:0    0   477G  0 disk  
├─nvme0n1p1   259:1    0   680M  0 part  /boot
├─nvme0n1p2   259:2    0 475.3G  0 part  
│ └─cryptroot 254:0    0 475.3G  0 crypt /
└─nvme0n1p4   259:3    0   990M  0 part  

~ 
[I] ➜ sudo fdisk -l
[sudo] password for art: 
Disk /dev/nvme0n1: 476.96 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: KXG60ZNV512G NVMe TOSHIBA 512GB         
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: gpt
Disk identifier: 246817B2-7F93-4723-8F53-B499C07511A3

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048    1394687   1392640   680M EFI System
/dev/nvme0n1p2   1394688  998158335 996763648 475.3G Linux filesystem
/dev/nvme0n1p4 998158336 1000185855   2027520   990M Windows recovery environment


Disk /dev/mapper/cryptroot: 475.29 GiB, 510326210560 bytes, 996730880 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

~ took 5s 

~ 
[N] ➜ sudo dd if=/home/art/Downloads/TriblerDownloads/ubuntu-19.10-desktop-amd64.iso of=/dev/sda bs=4M status=progress 
587+1 records in
587+1 records out
2463842304 bytes (2.5 GB, 2.3 GiB) copied, 0.728635 s, 3.4 GB/s

~ 
[I] ➜ pgrep dd -l
# No dd here.

更新,dmesg:

[167395.353737] usb 2-1: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
[167395.376079] usb 2-1: New USB device found, idVendor=8564, idProduct=1000, bcdDevice=11.00
[167395.376084] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[167395.376088] usb 2-1: Product: Mass Storage Device
[167395.376091] usb 2-1: Manufacturer: JetFlash
[167395.376094] usb 2-1: SerialNumber: 25KD7JEKLN6J409K
[167395.379692] usb-storage 2-1:1.0: USB Mass Storage device detected
[167395.380037] scsi host3: usb-storage 2-1:1.0
[167396.745065] scsi 3:0:0:0: Direct-Access     JetFlash Transcend 16GB   1100 PQ: 0 ANSI: 6
[167396.746488] sd 3:0:0:0: [sda] 30851072 512-byte logical blocks: (15.8 GB/14.7 GiB)
[167396.747105] sd 3:0:0:0: [sda] Write Protect is off
[167396.747111] sd 3:0:0:0: [sda] Mode Sense: 43 00 00 00
[167396.747634] sd 3:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[167396.751767]  sda: sda1
[167396.754816] sd 3:0:0:0: [sda] Attached SCSI removable disk

USB 類型:USB 3.1 Gen 1 埠。它是戴爾 Latitude 5401。

嘗試了兩個 USB 快閃記憶體驅動器。兩者都不起作用。

更新 2。

ls -l /dev/sda*
-rw-r--r-- 1 root root 2463842304 Nov  2 16:48 /dev/sda
brw-rw---- 1 root disk       8, 1 Nov  2 17:03 /dev/sda1

您將文件視為/dev/sda不是設備,因此當您寫入時,/dev/sda您將覆蓋該文件。使用您的 NVMe 磁碟,這就解釋了為什麼寫入速度如此之快。

刪除文件/dev/sda,拔下並重新插入 U 盤。檢查/dev/sda現在是塊設備(來自ls -lis的第一個字元b)而不是文件(第一個字元-),如下所示:

brw-rw---- 1 root disk       8, 0 Nov  2 17:03 /dev/sda
brw-rw---- 1 root disk       8, 1 Nov  2 17:03 /dev/sda1

這怎麼發生的?您可能在插入設備之前首先嘗試寫入設備,因此尚未創建設備節點。此後,該文件的存在阻止了該設備的創建。

引用自:https://unix.stackexchange.com/questions/550031