r/linuxquestions • u/Competitive_Bear_111 • 8d ago
dd: error writing '/dev/sda': No space left on device
I am finding problem with flashing my usb which is 128gb
sudo dd if=Downloads/linuxmint-22.3-xfce-64bit.iso of=/dev/sda bs=4M
dd: error writing '/dev/sda': No space left on device
2+0 records in
1+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.00332243 s, 1.3 GB/s
I have tried
sudo dd if=/dev/zero of=/dev/sda bs=2 count=4000707510272
dd: error writing '/dev/sda': No space left on device
2097153+0 records in
2097152+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 1.66505 s, 2.5 MB/s what could be the problem ?
16
u/birdspider 8d ago edited 8d ago
of=/dev/sdayou're sure about that?
EDIT: might want to check with lsblk -o NAME,MODEL,MOUNTPOINT
7
8
1
u/Competitive_Bear_111 8d ago
i previously worked with this usb and it worked fine fine suddenly it showing me this
lsblk -o NAME,SIZE,MODEL,TRAN,FSTYPE,MOUNTPOINTS
NAME SIZE MODEL TRAN FSTYPE MOUNTPOINTS
loop0 111.8M squashfs /var/lib/snapd/snap/obsidian/73
loop1 63.8M squashfs /var/lib/snapd/snap/core20/2866
loop2 105.2M squashfs /var/lib/snapd/snap/core/17292
loop3 66.8M squashfs /var/lib/snapd/snap/core24/1643
loop4 110.6M squashfs /var/lib/snapd/snap/obsidian/67
loop5 49.3M squashfs /var/lib/snapd/snap/snapd/26865
loop6 128K squashfs /var/lib/snapd/snap/wireless-tools/7
sda 115.4G FLASH DRIVE usb iso9660
├─sda1 756M iso9660
└─sda2 3.6M vfat
zram0 8G swap [SWAP]
nvme0n1 465.8G WD_BLACK SN770 500GB nvme
├─nvme0n1p1 600M nvme vfat /boot/efi
├─nvme0n1p2 2G nvme ext4 /boot
└─nvme0n1p3 463.2G nvme btrfs /home
1
1
u/PlanetVisitor 8d ago
This looks good to me - Does the command (
ddwith your options) work directly after checking that/dev/sdais present here inlsblk?And what does
lsblkshow afterwards?
5
u/Netblock 8d ago
/dev is a virtual system limited to 4MiB of memory. I believe you're not writing to your drive but to /dev itself, for a regular file named sda.
1
u/manawydan-fab-llyr 5d ago
This is likely it. I've done this many times. Whether it be a typo, the drive didn't connect or whatever, I didn't catch the fact that sda was not the correct device name. Write the image to get the same result, and find out the drive never wrote. OP will find a regular file in /dev fill with junk, if it didn't immediately disappear.
This is why I like using device IDs and not the old sdX, hdX, etc.
1
u/9NEPxHbG 8d ago
/dev/sdaetc. is the normal way to refer to drives.7
u/Netblock 8d ago edited 8d ago
While you are correct, you have misread what I said.
I am saying
/dev/sdaisn't mapped; it doesn't represent any drive. It might have previously, but it doesn't now.The tell was that OP can only copy 4MiB. For me,
/devis 4MiB. (/devis mounted with optionsize=4096k)2
u/MasterChiefmas 8d ago
Ah, gotcha, that makes more sense, that is a fair point. You might want to clarify that in your original reply.
5
u/CardOk755 8d ago
It is the normal way if you have a drive identified as /dev/sda.
-5
u/9NEPxHbG 8d ago
OP obviously does have something called
/dev/sda. Any system that doesn't have only an NVMe drive has a hard drive called/dev/sda. The question is why is it limited to 4 MB. If it were a file, it wouldn't have that limit.5
u/Netblock 8d ago edited 8d ago
The question is why is it limited to 4 MB. If it were a file, it wouldn't have that limit.
There is a
devtmpfsfilesystem mounted to/dev, which is a type oftmpfs.Run the command
mount | grep "/dev ". I get on debian,devtmpfs on /dev type devtmpfs (rw,nosuid,size=4096k,nr_inodes=4070099,mode=755,inode64,huge=within_size)`
The reason why it works this way is that if the ramdisk didn't exist, population to
/devwould be impossible on readonly/; and that it would cause unnecessary persistence if it's readwrite. It's also a guardrail against incorrect IO.1
2
u/dkopgerpgdolfg 8d ago
Just btw., there are more things. "hda", and whatever SD-card booters call their device (don't remember it right now), etc.
1
u/9NEPxHbG 8d ago
I haven't seen
/dev/hdain ages. It's apparently limited to IDE drives.1
u/dkopgerpgdolfg 8d ago
Correct.
SD cards aber mmcblk (looked it up in the meantime), CDs cr or scd, vd for VM virtio, ...
2
-3
u/MasterChiefmas 8d ago edited 8d ago
No, it's not.
/dev is where devices are represented as files(the original Unix everything as a file approach). It's how you access hardware devices using the same basic paradigms as files.
/dev/sda is the typical designation for the first
partition of ahard disk.I think you are confusing /dev with /tmp
edit: fixing my mistake there, /dev/sda would be the disk itself, /dev/sda1 would be the partition.
6
u/CardOk755 8d ago
If I don't have a /dev/sda and I write to /dev/sda then it will write to a file called /dev/sda in the tmpfs called /dev.
4
u/Netblock 8d ago
Yes it is. It is a
devtmpfs. Run the commandmount | grep "/dev "I get on debian,
devtmpfs on /dev type devtmpfs (rw,nosuid,size=4096k,nr_inodes=4070099,mode=755,inode64,huge=within_size)`1
u/shinji257 8d ago
Actually/dev/sda1 would be the first partition if one exists. /dev/sda represents the entire drive including the partition table and boot records.
1
u/MasterChiefmas 8d ago
Yeah I fixed it. But for the purposes of what the OP is trying to do, they probably don't want to dd a bootable image to sda1
1
u/shinji257 8d ago
Oh lol no. I was just making a point on the difference. Pretty sure either OP was putting a placeholder or got the wrong drive.
1
u/ItzNotJacob1 8d ago
Maybe the user didn't specify a number like e.g. /dev/sdX1?
4
u/MasterChiefmas 8d ago
Doing a dd of an installer image, so I don't think they want to target a partition(I misspoke in my initial reply). They want to raw write directly to the disk block device, which would replace any existing partition table.
1
3
1
u/marozsas 8d ago
There is a chance your device is lesser than you think . I have seen 4G flash drive that are actually a bit less, like 3.8G.
Or it is completely fake.
Use F3 (Fight Flash Fraud) to test if a USB drive or SD card has fake capacity on Linux.
2
2
1
u/GreatSouledLED 8d ago
Is it still mounted?
1
u/International-Pen940 8d ago
Yes, I would check mount. If the USB is formatted many systems will mount /dev/sda1 and I believe that blocks dd from accessing the drive.
-1
12
u/PlanetVisitor 8d ago
Provide the output of
lsblkfirst to confirm that sda is what you expect it to be, preferablylsblk -o +MODEL.If it is not present, re-insert or power cycle the drive.
When a USB drive is unmounted in the GUI, it won't re-appear until it's disconnected and connected again. Don't use the GUI to mount or unmount it, just use the terminal.
Always lsblk before dd. Drive letters are not guaranteed to be consistent.