Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The file /usr/share/doc/linux-doc/usb/persist.txt.gz mentions that the USB-persist capability can be enabled for a given USB device by writing 1 to the file persist in that device's directory in /sys/bus/usb/devices/$device/power. This is said — if I understood correctly — to allow mountings of volumes on the drive to persist across power loss during suspend.

However, I've discovered that the device I'd like to enable this facility for — a USB hard drive — does not have such a file in its corresponding directory, and that attempts to create it are rebuffed.

Is there perhaps a kernel module that needs to be loaded for this to work? Do I need to build a custom kernel? I'm running ubuntu 10.10.

share|improve this question
1  
cross-posted on AskUbuntu –  intuited Jan 6 '11 at 7:52
    
Can you give us the exact path you are trying to use for the file? Where do you echo "1"? Did you try to do that before/after the device was connected? Does this problem still exist? –  Patkos Csaba Feb 13 '12 at 20:07
    
I doubt the exact path will help, it depends on the vagaries of the USB tree of the machine. –  vonbrand Jan 25 '13 at 21:56
add comment

1 Answer 1

As noted at the end of answer this is presumably already on. (Also when Q was posted.)

Also note that the cross post was closed due to no answer – thus most appropriate to post here. And I imagine others can have use of the information.


The doc you linked say (emphasize mine):

[…]
Note that the "USB-persist" feature will be applied only to those devices for which it is enabled. You can enable the feature by doing (as root):

echo 1 >/sys/bus/usb/devices/.../power/persist

where the "..." should be filled in the with the device's ID. Disable the feature by writing 0 instead of 1. For hubs the feature is automatically and permanently enabled and the power/persist file doesn't even exist, so you only have to worry about setting it for devices where it really matters.

In other words: (it seems like) you are trying to set it for a hub, which both is redundant – as it is always set, and not possible as file does not exist.

To see which paths actually has a persist file do:

$ ls -l /sys/bus/usb/devices/*/power/persist

To check status do:

$ tail /sys/bus/usb/devices/*/power/persist

If you use lsusb to identify device the correct path is

/sys/bus/usb/devices/<BUS>-<DEVPATH>/power/persist
  • <BUS> is from lsusb
  • <DEVPATH> you can match against Device from lsusb by:

    $ tail <BUS>-*/devnum
    

Or check dmesg, etc. e.g.:

$ dmesg | grep -iA3 "new usb"

You can also verify by e.g.:

$ udevadm info -q all -p /sys/bus/usb/devices/<BUS>-<DEVPATH>

The policy for persist was changed to on as default by kernel 2.6.26-rc5.

Some ref's on the change to enabled by default:

The implementation:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.