You are not logged in.
Pages: 1
Hey guys, recently I've lost all my flash drivers' data when dealing with it.
I noticed the problem was probably the way I do it when I had the same problem on Gentoo (at first I was trying on Arch).
So, this is the way I manually plug and unplug my flash drive, do you see any problem?
On Plug
mount /dev/sdX /mnt/flashdrive1Before Physically Unplug
umount /mnt/flashdrive1
eject /dev/sdXLast time I formatted it and put some files, I didn't lost them because I didn't use eject.
Btw, I think I "lost" them because when I replug it, lsblk doesn't detect any partition.
Last edited by PandaSoli (2023-12-27 15:50:51)
Offline
NOTES eject only works with devices that support one or more of the four methods of ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE versions), and LS120 removable floppies.
For USB sticks only the `umount` command is needed before removing the device.
USB sticks are frangible by nature, especially if you bought a cheap one, so it probably just wore out.
Jin, Jîyan, Azadî
Offline
Btw, I think I "lost" them because when I replug it, lsblk doesn't detect any partition.
Run "dmesg -w", plug in the drive and post the tail dmesg produced.
Also (afterwards)
lsblk -f
fdisk -l /dev/sdX # replace the X w/ the actual deviceBut that't not a symptom of an unclean retraction, but rather a dying flash drive…
Offline
Thank you very much @Head_on_a_Stick!
I'll take more care about man's notes section from now on.
@seth Not gonna relost my data to test it bro hahaha it just got solved. And thank you for helping too!
Last edited by PandaSoli (2023-12-26 20:31:23)
Offline
eject(1) wrote:NOTES eject only works with devices that support one or more of the four methods of ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE versions), and LS120 removable floppies.For USB sticks only the `umount` command is needed before removing the device.
Contrary to the name, eject command’s operation is not limited to physically ejectable media. It combines multiple operations, which have a similar human-observable effect. Among these are USB mass storage devices, which eject shuts down. This is what “safely remove” features do in desktop environments. In the very first line of the description (emphasis added):
eject allows removable media (typically a CD-ROM, floppy disk, tape, JAZ, ZIP or USB disk) to be ejected under software control.
What isn’t needed, is the umount command: eject performs unmounting, if neccessary.
PandaSoli claims it’s solved, but I don’t see how. I also don’t know, how the data is going to be “relost” by reading the stick. I agree with seth, that it looks like a dying USB stick.
Last edited by mpan (2023-12-27 02:29:13)
Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
I am prepared to accept that failure to pass the eject command might cause issues with a USB-connected powered spinning rust drive but I find it doubtful that the same would apply to an unpowered USB stick, which is what this thread is about.
The thread is [SOLVED] because the OP was asking if they did anything wrong, which they did not.
Jin, Jîyan, Azadî
Offline
mpan What do you mean with it shuts down the flash drive?
I may sounds like a dumb question but, if a flash device lost its energy it lost the data it stores as it stores data with energy (not the best explanation),
or you mean that it closes the I/O connection? if this is what it does, how may I turn it on again?
I said it was resolved because so far what I understood was that I was doing wrong by using eject.
Head_on_a_Stick
Yes, it was just to know what I was doing wrong exactly.
But if you don't mind, as you guys said a lot of interesting things, I would like to keep this topic open to make some tests to understand better the problem, because I don't think my flash drivers are of poor quality.
I'll make tests sync, those commands seth said, and others I've found in another forum so far.
Offline
if a flash device lost its energy it lost the data it stores as it stores data with energy
That depends very much on what you define as "flash drive", but certainly not for https://en.wikipedia.org/wiki/NAND_flash_memory (ie. your average usb key)
I was doing wrong by using eject
Eject for all intents and purposes isn't necessary (again: assuming this is a regular-ass usb key) but won't harm and certainly not cause the symptoms you described.
I don't think my flash drivers are of poor quality
s/think/hope/g
others I've found in another forum so far
Do not type random stuff you've found on the interwebz into an interactive shell - recipe for disaster.
Offline
I don't get those circuity stuff.
but won't harm and certainly not cause the symptoms you described.
That's why I wanna understand what is going on.
Meaning of "think"
Meaning of "guess"
Do not type random stuff you've found on the interwebz into an interactive shell - recipe for disaster.
That's exactly what I'm doing being here.
But of course, i'm not a dumb-asshole that would type doas umount -fdaR.
btw, I've discovered smth.
If I run eject /dev/sdX, dmesg -w shows:
sdX: detected capacity change from 15633408 to 0Last edited by PandaSoli (2023-12-27 15:29:32)
Offline
I don't get those circuity stuff.
Post the output of the commands in #3
The gist of the wikipedia article is that the type of memory that's commonly used in usb keys is not volatile and the information will stay there without external power. Unlike eg. RAM.
btw, I've discovered smth.
You've discovered that if you eject a device it's logically gone
Post the output of the commands in #3
Offline
$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
│ swap 1 0c2670dc-65d6-47d3-beb6-3acf30e01c2c [SWAP]
├─sda2
│ ext4 1.0 eadaf4a5-a61f-49b4-837b-87e9d685233b 60.2M 59% /boot
└─sda3
ext4 1.0 4d9a5502-b822-49df-90a3-555bc5a83626 395.4G 8% /
sdb
sdc
$ sudo fdisk -l /dev/sdc
fdisk: cannot open /dev/sdc: No medium foundThis is what happens with I run them after running eject.
PS: Ignore sdb, I got no idea what it is, but I'm sure my device is sdc.
Offline
This is what happens with I run them after running eject.
if you eject a device it's logically gone
Re-plug the device first.
Offline
$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
│ swap 1 0c2670dc-65d6-47d3-beb6-3acf30e01c2c [SWAP]
├─sda2
│ ext4 1.0 eadaf4a5-a61f-49b4-837b-87e9d685233b 60.2M 59% /boot
└─sda3
ext4 1.0 4d9a5502-b822-49df-90a3-555bc5a83626 395.4G 8% /
sdb
sdc
├─sdc1
│ exfat 1.0 Ventoy DC20-8060
└─sdc2
vfat FAT16 VTOYEFI B2C8-40D2 ;-; it must be kidding me.
last time I had a really important data loss even re-plugging it didn't show any partitions, this is why I asked for help.
maybe because this time I ran sync before umount and eject?
I don't understand what just happened.
I'm really sorry for screwing your time for nothing guys.
I'll probably only discover the reason in the next data loss situation.
Offline
Head_on_a_stick: to be clear, my intention was noting that eject does work and has a particular function for USB media. Not that it played role here.
PandaSoli: again, invoking sync is not needed. umount will perform a sync call.
Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!
Offline
Pages: 1