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.
|
|
11-20-2006, 04:08 AM
|
#1
|
Member
Registered: Oct 2005
Posts: 116
Rep:
|
USB Pen Drive / Flash Drive Unmounted but the power is there
Hello to all
Thanks to all for such a good solutions.
I have the problem with my Pen Drives i.e iam using the Redhat Enterprise Linux 4 and my problem is when iam inserting the pen drive it installed correctly and every thing went correct. After whenever i unmount the pen drive the icon on the desktop disappears but the light of the Pen drive is still glowing. When i removed the pen drive in this conditions twice my Pen Drive corrupted and i have to purchase another.
Any one please help me how i should remove the pen drive from the system in linux. After unmounting the pen drive how to turnoff the power to pen drive.
Please give the information
it will be very helpfull for us.
|
|
|
11-20-2006, 08:15 AM
|
#2
|
Member
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471
Rep:
|
There are no way to turn off power on USB port (except unloading kernel module maybe) and no one care about this, becouse unmounting is sufficient. Power on USB line can't damage pen drive when unplugging. When you lose your drive it isn't a power problem, it's a defect in this drive.
|
|
|
11-20-2006, 08:23 AM
|
#3
|
Member
Registered: Oct 2006
Location: brisbane - australia
Distribution: ubuntu
Posts: 335
Rep:
|
i agree with Samotnik, another thing that might be a problem is that the drive is still being written to by the os. you should always wait for a few seconds (10 or so) before pulling it out. you can also tell if it is still in use when you look at the light and it is still flashing. I have noticed that windows 'unmounts' the drive differently as it turns off the led. I use a pendrive all the time and haven't come accross to actually damaging/corrupting the drive.
|
|
|
11-20-2006, 11:25 PM
|
#4
|
Member
Registered: Oct 2005
Posts: 116
Original Poster
Rep:
|
when
when i turnoff the or stop the pen drive in windows usually the light goes off.
But where as in Linux still the light glows.
Cause of loss of Pen-Drive: It is showing the pendrive but unable to browse the pen drive in linux when my previous pen drives went wrong.
Just i want to know is the light glows off like in windows or not.
Please give the info
with regards
teluguswan
|
|
|
11-21-2006, 12:30 AM
|
#5
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
By design, all USB ports are powered, and anytime you insert a USB device into the slot, it will automatically be powered on. This is really useful and helpful, and the basic idea is simply that when you plug in the USB device, you clearly intend on using it, and therefore the computer should not force you to take any other actions to turn it on. Or to say it the other way, if you didn't want the device to be enabled, you wouldn't have plugged it into the slot in the first place.
Anyhow, in the case of pen drive (or any other USB storage unit), the act of mounting it to a mountpoint (and thus making the data accessible) could be automatic or require a manual step. It depends on your system, but either way it would be perfectly normal to have a pen drive be powered on but unmounted. The fact that the light still glows after you unmount it is OK.
|
|
|
08-09-2007, 09:16 PM
|
#6
|
LQ Newbie
Registered: Sep 2004
Distribution: RedHat/Fedora/Debian
Posts: 11
Rep:
|
Quote:
Originally Posted by Samotnik
There are no way to turn off power on USB port (except unloading kernel module maybe) and no one care about this, becouse unmounting is sufficient. Power on USB line can't damage pen drive when unplugging. When you lose your drive it isn't a power problem, it's a defect in this drive.
|
I think he wants just what Windows users see. When a drive is unmounted under Windows, power to that port alone is cut and the drives light goes out. (note that simply removing the usb modules is not a solution here as there may be other devices still connected).
This is a rather sensible safeguard to teach your users if you ask me: "If the little light is on, don't pull it out".
|
|
|
08-09-2007, 11:41 PM
|
#7
|
Member
Registered: Oct 2005
Posts: 116
Original Poster
Rep:
|
Yes I thought the Same, When the Power goes off then only it is totally off. I thought like that if the same happens.
|
|
|
08-11-2007, 03:14 AM
|
#8
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep:
|
Check the logs. Could be a bad bit. If it is damaged, you should have some patience.
Flash NAND memory is very, very slow. The throughput is about a few hundred kilobytes. Also it is more prone to failing when power is abruptly disconnected during use (writing or reading).
All devices connected to USB are powered, so be careful disconnecting the cable while they are processing.
USB devices are always powered even if you think they are not.
|
|
|
11-17-2007, 11:18 AM
|
#9
|
LQ Newbie
Registered: Nov 2003
Posts: 4
Rep:
|
What Windows does is putting USB device in suspend mode.
Use the following script for doing the same:
Code:
#!/bin/bash
if [ -z $1 ]; then
echo 'device not specified'
exit 1
fi
DEVICE=$(udevinfo --query=path --name=$1 --attribute-walk | grep 'USB Mass Storage Device' -B5 | head -n 1 | cut -d"'" -f2)
if [ -z $DEVICE ]; then
DEVICE=$(udevinfo --query=path --name=$1 --attribute-walk | grep 'USB2.0 Storage Device' -B5 | head -n 1 | cut -d"'" -f2)
if [ -z $DEVICE ]; then
echo 'not an USB mass storage device'
exit 1
fi
fi
echo 'suspend' > /sys/$DEVICE/power/level
Example usage:
# ./suspend-device.sh /dev/sdc
|
|
|
11-18-2007, 04:04 PM
|
#10
|
LQ Newbie
Registered: Sep 2004
Distribution: RedHat/Fedora/Debian
Posts: 11
Rep:
|
Thank you!
This is exactly what I was after, thank you.
It works perfectly too. When the drive is plugged in it is usually noticeably hot. When put into suspend it cools down to room temperature so not only is the light off, the unit itself is drawing very little (if any) current. I've extended the script a bit so you can wake it back up too without having to plug it back in. Just cat 'on' or 'auto' instead of 'suspend' to the level file.
Now to bring this to the masses we have to figure out how to tie it into Gnome and KDE's "safely remove" feature. Ideally 'removing' a USB drive should do something like this:
sync
umount /media/sd*
suspend-device.sh /dev/sd*
|
|
|
11-19-2007, 02:50 AM
|
#11
|
LQ Newbie
Registered: Nov 2003
Posts: 4
Rep:
|
Quote:
Originally Posted by gregtrounson
Now to bring this to the masses we have to figure out how to tie it into Gnome and KDE's "safely remove" feature. Ideally 'removing' a USB drive should do something like this:
sync
umount /media/sd*
suspend-device.sh /dev/sd*
|
sync is not needed when mounting flash with the new 'flush' option (appeared in kernel 2.19 IIRC). With -o flush data are written on filesystem as soon as possible but the process is much faster than with -o sync.
The latest HAL releases already recognize 'flush' as a valid mount option, just add it to default mount options in KDE config centre.
|
|
|
10-04-2008, 03:36 PM
|
#12
|
LQ Newbie
Registered: Nov 2003
Posts: 4
Rep:
|
updated version of suspend-device.sh
Wanted to try the script again today, and found that it doesn't work with the latest udev because there are many more ATTRS than grep -B5 intended to skip.
So here's an improved version that works with much greater number of ATTRS in the needed device.
Code:
#!/bin/bash
if [ -z $1 ]; then
echo 'device not specified'
exit 1
fi
DEVICE=$(udevinfo --query=path --name=$1 --attribute-walk | grep 'USB Mass Storage Device' -B50 | grep 'looking at parent device' | tail -n 1 | cut -d"'" -f2)
if [ -z $DEVICE ]; then
DEVICE=$(udevinfo --query=path --name=$1 --attribute-walk | grep 'USB2.0 Storage Device' -B50 | grep 'looking at parent device' | tail -n 1 | cut -d"'" -f2)
if [ -z $DEVICE ]; then
echo 'not an USB mass storage device'
exit 1
fi
fi
|
|
|
All times are GMT -5. The time now is 02:09 PM.
|
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
|
|