Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-21-2021, 01:24 PM
|
#1
|
Senior Member
Registered: Jul 2020
Posts: 1,523
|
can SD card fail this way?
Bona fide "32G" SD card which did successfully hold 29G of data suddenly started accepting no more than 4G. It happened when I tried to write partition image to it:
Code:
# dd if=car.sd.sandisk.dd of=/dev/sdj1 bs=16384
dd: error writing '/dev/sdj1': No space left on device
248773+0 records in
248772+0 records out
4075892736 bytes (4.1 GB, 3.8 GiB) copied, 20.7289 s, 197 MB/s
Always fails at exactly the same place after 4075892736 bytes. When I tried to re-create filesystem it created a 4G one
Code:
# /sbin/mkfs.vfat -v /dev/sdj1
mkfs.fat 4.1 (2017-01-24)
Auto-selecting FAT32 for large filesystem
/dev/sdj1 has 255 heads and 63 sectors per track,
hidden sectors 0x0000;
logical sector size is 512,
using 0xf8 media descriptor, with 7960728 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 7760 sectors, and provides 993147 clusters.
There are 32 reserved sectors.
Volume ID is cb2429a9, no volume label.
even though partition is a 29G one
Code:
Command (m for help): p
Disk /dev/sdj: 29 GiB, 31104958464 bytes, 60751872 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: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdj1 8192 60751871 60743680 29G c W95 FAT32 (LBA)
Ok, flash cards do fail - nothing unusual here, but two things make me suspicious: there are no messages in syslog about bad sectors and such - no errors at all, and the writing speed of the image is way too high - it is a Class 10 card good for 10 MB/sec, not 200. I am on ubuntu 18.04, and there is some background automount trickery goes on for usb devices. So... am I missing something?
|
|
|
02-21-2021, 02:03 PM
|
#2
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,415
|
Quote:
dd if=car.sd.sandisk.dd of=/dev/sdj1 bs=16384
|
You wrote to a partition and not the device.
What is the output of, with the device plugged in.
Code:
fdisk -l
lsblk
parted -l
Quote:
/sbin/mkfs.vfat -v /dev/sdj1
|
That's a partition. How large is it? Is there free space on the device? Other partitions?
Edit:
Oh I see, didn't read good enough.
If you are sure that /dev/sdj is the usb device
Code:
dd if=/dev/zero of=/dev/sdj bs=1M count=10
Then start over. That will wipe the partition table.
Last edited by teckk; 02-21-2021 at 02:06 PM.
|
|
|
02-21-2021, 05:29 PM
|
#3
|
Senior Member
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591
|
If it has FAT32 file system, largest file size is 4GB. If you want to write larger files like a 16GB flash drive image perhaps, you need to use a different file system on the destination drive. Like extFAT, ext4, ntfs
Quote:
Device Boot Start End Sectors Size Id Type
/dev/sdj1 8192 60751871 60743680 29G c W95 FAT32 (LBA)
|
|
|
|
02-22-2021, 03:23 AM
|
#4
|
Senior Member
Registered: Jul 2020
Posts: 1,523
Original Poster
|
Here is what lsblk and parted say about it - consistent with fdisk which was in my original message.
Code:
sdj 8:144 1 29G 0 disk
└─sdj1 8:145 1 29G 0 part
Model: Generic Ultra HS-SD/MMC (scsi)
Disk /dev/sdj: 31.1GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 31.1GB 31.1GB primary fat32 lba
And zeroing and re-creating partition table have no effect at all. The thing that baffles me most is the write speed - there is no way it can write to a fairly slow SD card that fast, and AFAIK there could be no write-back caching when writing directly to a device. Or could it? - another weird thing I noticed is that for some reason df refers to this card not as /dev/sdj1 but as /dev/loop0
Code:
/dev/loop0 3972588 4 3972584 1% /media/lvm/FE30-5469
although mount sees it as /dev/sdj1 and doesn't mention /dev/loop0 at all
Code:
/dev/sdj1 on /media/lvm/FE30-5469 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022
and udisksd doesn't mention loop0 either in syslog messages
Code:
udisksd[877]: Mounted /dev/sdj1 at /media/lvm/FE30-5469 on behalf of uid 1000
When, however, I write to /dev/sdj write speed is the expected ~10 MB/sec. So what's happening here?
Quote:
Originally Posted by Brains
If it has FAT32 file system, largest file size is 4GB. If you want to write larger files like a 16GB flash drive image perhaps, you need to use a different file system on the destination drive. Like extFAT, ext4, ntfs
|
What filesystem limitations have to do with inability to write to a block device where it is stored? Nothing at all. I didn't even try to access the filesystem yet.
|
|
|
02-22-2021, 08:35 AM
|
#5
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,815
|
Quote:
Originally Posted by lvm_
another weird thing I noticed is that for some reason df refers to this card not as /dev/sdj1 but as /dev/loop0
Code:
/dev/loop0 3972588 4 3972584 1% /media/lvm/FE30-5469
although mount sees it as /dev/sdj1 and doesn't mention /dev/loop0 at all
|
That looks like you might have accidentally created an ordinary file named "sdj1" in the /dev directory, and the 4GB size limit you are seeing is just the maximum size of the pseudo-filesystem mounted on /dev.
|
|
1 members found this post helpful.
|
02-22-2021, 09:08 AM
|
#6
|
Senior Member
Registered: Jul 2020
Posts: 1,523
Original Poster
|
Quote:
Originally Posted by rknichols
That looks like you might have accidentally created an ordinary file named "sdj1" in the /dev directory, and the 4GB size limit you are seeing is just the maximum size of the pseudo-filesystem mounted on /dev.
|
Indeed I am. You are a genius, sir.
|
|
|
All times are GMT -5. The time now is 02:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|