Remount an ejected USB Stick?

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

Remount an ejected USB Stick?

Postby sambul13 » Sun Oct 21, 2012 1:44 pm

Is there a way to remount an ejected but not detached USB Stick without reinserting it into a Plug? Once ejected, it reads in dmesg as /dev/sdb, without any volume IDs.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: Remount an ejected USB Stick?

Postby pepedog » Sun Oct 21, 2012 2:39 pm

Lazy way if auto mount, install parted and run partprobe
Or use mount
Or have an fstab entry and run mount -a
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Remount an ejected USB Stick?

Postby sambul13 » Sun Oct 21, 2012 3:15 pm

Thanks, but it doesn't work, because once the Thumb is ejected, it doesn't show any volumes in the system, only appears as /dev/sdb. I.e., there is no /dev/sdb1 that I can mount by known means. The volume needs to be found, or device rescanned, or its info refreshed 1st - any ideas? ;)
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: Remount an ejected USB Stick?

Postby karog » Sun Oct 21, 2012 5:05 pm

Here is a wild guess that finds SATA on Pogo V3's and who knows might work. Worth a try
$this->bbcode_second_pass_code('', '
echo "0 0 0" > /sys/class/scsi_host/host0/scan')
where
$this->bbcode_second_pass_code('', '
echo "c t l" > /sys/class/scsi_host/hosth/scan
')
In the previous command, last h in hosth is the HBA number, c is the channel on the HBA, t is the SCSI target ID, and l is the LUN.
karog
 
Posts: 304
Joined: Thu Jan 05, 2012 7:55 pm

Re: Remount an ejected USB Stick?

Postby sambul13 » Sun Oct 21, 2012 6:05 pm

Unfortunately, the wild guess doesn't work. Here is what I got once the Thumb was originally mounted and then ejected:

$this->bbcode_second_pass_code('', 'sdb: sdb1
------------------------------------------------------
sd 8:0:0:0 [sdb] Attached SCSI removable disk # mounted
------------------------------------------------------
sdb: detected capacity change from 4049600512 to 0 # ejected

echo "0 0 0" > /sys/class/scsi_host/host8/scan # no change in dmesg')

I wonder if playing with udevadm trigger & settle can do the trick? Tried so far with no luck. See What happens when a USB drive is plugged in?
Last edited by sambul13 on Mon Oct 22, 2012 12:42 am, edited 1 time in total.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: Remount an ejected USB Stick?

Postby sambul13 » Mon Oct 22, 2012 12:12 am

$this->bbcode_second_pass_quote('karog', 'e')cho "0 0 0" > /sys/class/scsi_host/host0/scan
Actually, I don't get it. Does it mean, all SCSI devices will be written to /scan file? Shouldn't HBA number be present in Echo command too? The Thumb was ejected using Eject package.

I started udevadm monitor, and it shows commands of this type don't result in adding /dev/sdb1 , or rescanning the target. Even running udevadm trigger doesn't create /dev/sdb1 . May be modprobe usb-storage will do, though not recommended - nope doesn't do the trick either.

Even hdparm -z /dev/sdb doesn't do a thing. But... on wakeup from standby its rescanned OK, so its obvious there is a way to trigger udev sequence.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm

Re: Remount an ejected USB Stick?

Postby hydro » Tue Oct 23, 2012 9:45 am

I think this is some kind of bug in eject or xfce. It won't remove device nodes of motorized drives
$this->bbcode_second_pass_code('', '
# mount /dev/sdc1 /mnt
# mount|grep mnt
/dev/sdc1 on /mnt type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
# eject /dev/sdc1
# mount|grep mnt
# ls -1 /dev/sdc*
/dev/sdc
/dev/sdc1
/dev/sdc2
/dev/sdc3
')
I don't know why non motorized media device nodes are removed (this one has one partition only):
$this->bbcode_second_pass_code('', '
# mount /dev/sdb1 /mnt
# mount|grep mnt
/dev/sdb1 on /mnt type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
# eject /dev/sdb1
# ls -1 /dev/sdb*
/dev/sdb
')
But it can be recreated
$this->bbcode_second_pass_code('', '
# eject -t /dev/sdb
# ls -1 /dev/sdb*
/dev/sdb
/dev/sdb1
# mount /dev/sdb1 /mnt
# mount|grep mnt
/dev/sdb1 on /mnt type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
')
This does not work with every usb stick. So in my opinion the question is not how to rescan the device but why eject removes device nodes or rather why does xfce not just do a simple unmount.

Edit: You should link related threads
viewtopic.php?f=6&t=4002&p=22618
https://bbs.archlinux.org/viewtopic.php?id=151086

Edit2: Seems like the xfce devs expect you to not unmount/eject a removable device unless you intend to physically remove it afterwards.
http://comments.gmane.org/gmane.comp.de ... devel/4081
VDR on DockStar / Pogoplug E02: http://linux.bplaced.net/
hydro
 
Posts: 210
Joined: Wed Jun 15, 2011 2:03 pm
Location: Germany

Re: Remount an ejected USB Stick?

Postby sambul13 » Tue Oct 23, 2012 12:13 pm

Yah, it looks like Eject command includes USB Sticks improperly instead of Remove.

There may be indeed cleaner solution - avoid using relevant Thunar Volume Manager features in XFCE, since they seems to duplicate basic OS features.
sambul13
 
Posts: 258
Joined: Sat Aug 18, 2012 10:32 pm


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 3 guests