r/linuxquestions • • 3d 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 ?

4 Upvotes

37 comments sorted by

16

u/birdspider 3d ago edited 3d ago
of=/dev/sda

you're sure about that?

EDIT: might want to check with lsblk -o NAME,MODEL,MOUNTPOINT

15

u/ipsirc 3d ago

,SIZE

6

u/tk-a01 3d ago

If they have an NVMe SSD as their primary drive, then it's likely that the flash drive is the only device that gets assigned the sd prefix. But of course it's crucial to check if it's really the correct device.

12

u/PlanetVisitor 3d ago

Provide the output of lsblk first to confirm that sda is what you expect it to be, preferably lsblk -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.

1

u/Competitive_Bear_111 3d 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

u/CosmicFieldDrift_ 3d ago

Any kind of mechanical lock on the USB?

1

u/PlanetVisitor 3d ago

This looks good to me - Does the command (dd with your options) work directly after checking that /dev/sda is present here in lsblk?

And what does lsblk show afterwards?

8

u/wowsomuchempty 3d ago

Cheap scam USB sticks are fake - the storage is far less.

3

u/9NEPxHbG 3d ago

Either /dev/sda only has 4 MB or its defective.

4

u/Netblock 3d 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.

2

u/9NEPxHbG 3d ago

/dev/sda etc. is the normal way to refer to drives.

8

u/Netblock 3d ago edited 3d ago

While you are correct, you have misread what I said.

I am saying /dev/sda isn'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, /dev is 4MiB. (/dev is mounted with option size=4096k)

2

u/MasterChiefmas 3d 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 3d ago

It is the normal way if you have a drive identified as /dev/sda.

-5

u/9NEPxHbG 3d 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 3d ago edited 3d 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 devtmpfs filesystem mounted to /dev, which is a type of tmpfs.

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 /dev would be impossible on readonly /; and that it would cause unnecessary persistence if it's readwrite. It's also a guardrail against incorrect IO.

1

u/CardOk755 3d ago

size=4096k is 4Mb

2

u/CardOk755 3d ago

Depends how big /dev is. Normally it's a tmpfs.

2

u/dkopgerpgdolfg 3d 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 3d ago

I haven't seen /dev/hda in ages. It's apparently limited to IDE drives.

1

u/dkopgerpgdolfg 3d ago

Correct.

SD cards aber mmcblk (looked it up in the meantime), CDs cr or scd, vd for VM virtio, ...

-3

u/MasterChiefmas 3d ago edited 3d 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 a hard 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 3d 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 3d ago

Yes it is. It is a devtmpfs. 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)`

1

u/ItzNotJacob1 3d ago

Maybe the user didn't specify a number like e.g. /dev/sdX1?

4

u/MasterChiefmas 3d 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

u/ItzNotJacob1 3d ago

Ah, i'm stupid. Didn't think of that

1

u/shinji257 3d 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 3d 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 3d 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.

2

u/suicidaleggroll 3d ago

Are you sure the drive is functional?

2

u/iluvatar 3d ago

You have a faulty flash drive. Throw it away and get another one.

1

u/GreatSouledLED 3d ago

Is it still mounted?

1

u/International-Pen940 3d 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

u/marozsas 3d 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.

-1

u/CardOk755 3d ago

The problem is that you have a 4mb USB.