LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Weird happenings with memstick & files (http://www.linuxquestions.org/questions/slackware-14/weird-happenings-with-memstick-and-files-4175440519/)

AngryAngry 12-07-2012 10:05 PM

Weird happenings with memstick & files
 
Slackware 13.37, XFCE windows
I only keep my data on memory stick, and rarely restart - simply unmount and suspend. Sometimes I have many documents open and suspend then sneakily remove my memory stick then reattach before waking my computer.

I have noticed my memory stick sometimes auto remount after I have unmounted it instead of mounting as KINGSTON, it mounts as KINGSTON_

I have also noticed with some .txt files (which I have not accessed recently), an identical copy appears in Thunar file manager as .txt~

I'm certain you will scold me for my non-shutdown and stealth memstick removals, and will have the answers I seek.

marbangens 12-08-2012 06:02 AM

reproduce that and give less /var/log/syslog | tail -100

marbangens 12-08-2012 06:04 AM

Quote:

Originally Posted by AngryAngry (Post 4844924)
I have also noticed with some .txt files (which I have not accessed recently), an identical copy appears in Thunar file manager as .txt~

that is a backup file that is automatically created by many popular text editors

H_TeXMeX_H 12-08-2012 06:43 AM

I hope you don't keep any important data on a memory stick = flash media.

Diantre 12-08-2012 12:17 PM

Quote:

Originally Posted by AngryAngry (Post 4844924)
I'm certain you will scold me for my non-shutdown and stealth memstick removals, and will have the answers I seek.


Well, I found this bit of information in /usr/src/linux/Documentation/power/swsusp.txt, it might be related to your problem, or not... ;)

Code:

Q: Is this true that if I have a mounted filesystem on a USB device and
I suspend to disk, I can lose data unless the filesystem has been mounted
with "sync"?

A: That's right ... if you disconnect that device, you may lose data.
In fact, even with "-o sync" you can lose data if your programs have
information in buffers they haven't written out to a disk you disconnect,
or if you disconnect before the device finished saving data you wrote.

Software suspend normally powers down USB controllers, which is equivalent
to disconnecting all USB devices attached to your system.

Your system might well support low-power modes for its USB controllers
while the system is asleep, maintaining the connection, using true sleep
modes like "suspend-to-RAM" or "standby".  (Don't write "disk" to the
/sys/power/state file; write "standby" or "mem".)  We've not seen any
hardware that can use these modes through software suspend, although in
theory some systems might support "platform" modes that won't break the
USB connections.

Remember that it's always a bad idea to unplug a disk drive containing a
mounted filesystem.  That's true even when your system is asleep!  The
safest thing is to unmount all filesystems on removable media (such USB,
Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays)
before suspending; then remount them after resuming.

There is a work-around for this problem.  For more information, see
Documentation/usb/persist.txt.


AngryAngry 12-08-2012 11:11 PM

Quote:

Originally Posted by Diantre (Post 4845241)
Well, I found this bit of information in /usr/src/linux/Documentation/power/swsusp.txt, it might be related to your problem, or not... ;)

Code:

Q: Is this true that if I have a mounted filesystem on a USB device and
I suspend to disk, I can lose data unless the filesystem has been mounted
with "sync"?

A: That's right ... if you disconnect that device, you may lose data.
In fact, even with "-o sync" you can lose data if your programs have
information in buffers they haven't written out to a disk you disconnect,
or if you disconnect before the device finished saving data you wrote.

Software suspend normally powers down USB controllers, which is equivalent
to disconnecting all USB devices attached to your system.

Your system might well support low-power modes for its USB controllers
while the system is asleep, maintaining the connection, using true sleep
modes like "suspend-to-RAM" or "standby".  (Don't write "disk" to the
/sys/power/state file; write "standby" or "mem".)  We've not seen any
hardware that can use these modes through software suspend, although in
theory some systems might support "platform" modes that won't break the
USB connections.

Remember that it's always a bad idea to unplug a disk drive containing a
mounted filesystem.  That's true even when your system is asleep!  The
safest thing is to unmount all filesystems on removable media (such USB,
Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays)
before suspending; then remount them after resuming.

There is a work-around for this problem.  For more information, see
Documentation/usb/persist.txt.


Happily I haven't noticed any data loss so far. But yes I should probably stop doing it (cautiously scared now). I keep ALL my important data on multiple memory sticks, and one HDD copy.
I'm more worried about the constant mounting & unmounting without restarting linux - I believe it has been 2 months so far.

onebuck 12-10-2012 08:39 AM

Member Response
 
Hi,
Quote:

Originally Posted by AngryAngry (Post 4845473)
Happily I haven't noticed any data loss so far. But yes I should probably stop doing it (cautiously scared now). I keep ALL my important data on multiple memory sticks, and one HDD copy.
I'm more worried about the constant mounting & unmounting without restarting linux - I believe it has been 2 months so far.

Look at: (Linux is Not Windows) 'which refers to the GNU/Linux OS and various Free & Open-Source Software (FOSS) projects under the catch-all name of "Linux". It scans better.' + Great Article

Gnu/Linux reboots are not always necessary, especially when you are using a properly setup Slackware based system. :)

Sad that a lot of new users do not know or are referenced to good admin techniques or procedures;
Quote:

Just a few links to aid you to gaining some understanding;



1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Utimate Linux Newbie Guide

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

Once your system is properly setup and you as admin learn to execute or perform good maintenance then you should not worry. Learn to mount & dismount cleanly then you should not cause issues with either the flash or system. Hopefully you will learn not to worry about the system when used properly. :)
HTH!

AngryAngry 12-11-2012 08:23 PM

Thanks
 
I do unmount, but I have noticed KINGSTON is still there, and I can even open an empty Thunar window! That is why KINGSTON_ is being mounted - not sure that this solves anything.

I tried logging out of XFCE but that didn't help.

Thank you for the advice, I will definitely investigate those links.

onebuck 12-11-2012 09:15 PM

Member Response
 
Hi,

From the cli as root from console issue, 'sync' then 'umount /dev/your_device', be sure to replace 'your_device with the acutal device. You should see some activity for sync and the umount should allow you to remove device. Issue 'mount' to see what is still mount. You can always see what is mounted by using 'mount' command.


All times are GMT -5. The time now is 01:01 PM.