212,213b USB flash names not retained in Pmount, Univ Inst
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
I've modified it so the dd runs on the first 512 bytes of the drives (except cd/dvd), not any partitions. Attached.
- Attachments
-
- probepart-bk4.gz
- (1.09 KiB) Downloaded 488 times
Hi Barry,
I just tried your bk4 script with my test, and it is back to the old tricks.
(start with 32MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|vfat|62592
(swap to 256MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|ext3|510464
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb1|vfat|509992
(back to 32MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb1|none|509992
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|vfat|62592
To be perfectly honest, regarding your #1 and #2 points, I have no idea, I was just trying 'best guess' combinations until I came across a set that worked.
Jesse
I just tried your bk4 script with my test, and it is back to the old tricks.
(start with 32MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|vfat|62592
(swap to 256MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|ext3|510464
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb1|vfat|509992
(back to 32MB)
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb1|none|509992
sh-3.00# ./probepart-bk4 | grep sdb
/dev/sdb|vfat|62592
To be perfectly honest, regarding your #1 and #2 points, I have no idea, I was just trying 'best guess' combinations until I came across a set that worked.
Jesse
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
Jesse, do you have USB2? I can't duplicate the problem you report. I have tried to swap the usb drives quickly and rerun probepart immediately (the old version before your fix) but I don't get that problem. What I do get is a delay. It seems when I remove a drive, /proc gets updated immediately, but when I plug in a drive there is a delay before it registers in /proc.
So, if I unplug a drive and immediately rerun probepart, no sda drive shows up at all. I wait a second or two, rerun probepart and get the correct sda drive.
So, your fixes don't seem to be doing anything for me. The delay from when a drive is plugged in to registering in /proc seems to be more a function of the usb interface, the time it takes for a pen drive to respond to a query and provide its particulars.
I've been thinking of workarounds, but it doesn't help that you get a different problem, of the previous drive particulars persisting in /proc after the drive is removed. I wonder why I don't have that problem?
So, if I unplug a drive and immediately rerun probepart, no sda drive shows up at all. I wait a second or two, rerun probepart and get the correct sda drive.
So, your fixes don't seem to be doing anything for me. The delay from when a drive is plugged in to registering in /proc seems to be more a function of the usb interface, the time it takes for a pen drive to respond to a query and provide its particulars.
I've been thinking of workarounds, but it doesn't help that you get a different problem, of the previous drive particulars persisting in /proc after the drive is removed. I wonder why I don't have that problem?
Hi Barry,
Sorry I should have explained what my test was in a little more detail!
Yes, I have been doing my test case on USB2, and I have just now tried it on USB1.1 and I have the same issue.
You are probably using fully self contained USB drives, which makes all the difference, as there is a hot-plug event with the USB host adapter that lets the kernel know that something has been added or changed.
I am using a "USB Card Reader" which stays plugged into the USB, but the media is removable, removing/inserting the media does not generate a usb-hot-plug event and there is no directly caused kernel update of /proc files.
example of self-contained usb drive:
http://ps.synnex.co.nz/images/FM/50974.jpg
example of compact flash removable media:
http://www.eoneonline.co.nz/site/e-one3 ... ngston.jpg
example of Card Reader (overkill):
http://www.geeks.com/details.asp?invtid ... 25&cat=FLM
example of Card Reader (just like my one):
http://www.geeks.com/details.asp?invtid ... -C&cat=FLM
Over here in NZ, new computers seem to get an internal card reader instead of a floppy drive, from what I have seen. I think it makes sense.
With my reported problem, there is no need to be quick about swapping the CF media, if you wait 10 seconds or 0.5 seconds the /proc files are the same.
I hope that helps clear up what the issue is
Jesse
Sorry I should have explained what my test was in a little more detail!
Yes, I have been doing my test case on USB2, and I have just now tried it on USB1.1 and I have the same issue.
You are probably using fully self contained USB drives, which makes all the difference, as there is a hot-plug event with the USB host adapter that lets the kernel know that something has been added or changed.
I am using a "USB Card Reader" which stays plugged into the USB, but the media is removable, removing/inserting the media does not generate a usb-hot-plug event and there is no directly caused kernel update of /proc files.
example of self-contained usb drive:
http://ps.synnex.co.nz/images/FM/50974.jpg
example of compact flash removable media:
http://www.eoneonline.co.nz/site/e-one3 ... ngston.jpg
example of Card Reader (overkill):
http://www.geeks.com/details.asp?invtid ... 25&cat=FLM
example of Card Reader (just like my one):
http://www.geeks.com/details.asp?invtid ... -C&cat=FLM
Over here in NZ, new computers seem to get an internal card reader instead of a floppy drive, from what I have seen. I think it makes sense.
With my reported problem, there is no need to be quick about swapping the CF media, if you wait 10 seconds or 0.5 seconds the /proc files are the same.
I hope that helps clear up what the issue is
Jesse
Hi Barry,
This idea works for when the media changes, but if you remove the media and scan it, it disapears from /proc/partitions, you'll need to rescan the device node listed from /proc/diskstats to get it back into the /proc/partitions when there is a medium present:
I hope all that helps!
Jesse
This idea works for when the media changes, but if you remove the media and scan it, it disapears from /proc/partitions, you'll need to rescan the device node listed from /proc/diskstats to get it back into the /proc/partitions when there is a medium present:
Code: Select all
(start with 32MB)
sh-3.00# cat /proc/partitions | grep sdc
8 32 31296 sdc
(swap to 256MB)
sh-3.00# disktype /dev/sdc
--- /dev/sdc
Block device, size 249.3 MiB (261357568 bytes)
DOS partition map
Partition 1: 249.0 MiB (261115904 bytes, 509992 sectors from 56, bootable)
Type 0x06 (FAT16)
FAT16 file system (hints score 5 of 5)
Volume size 248.8 MiB (260841472 bytes, 63682 clusters of 4 KiB)
Volume name ""
Ext3 file system
UUID 5E93D6C6-44E3-4732-8D25-FB1CCDB7D88E (DCE, v4)
Volume size 249.3 MiB (261357568 bytes, 255232 blocks of 1 KiB)
sh-3.00# cat /proc/partitions | grep sdc
8 32 255232 sdc
8 33 254996 sdc1
(swap back to 32MB)
sh-3.00# cat /proc/partitions | grep sdc
8 32 255232 sdc
8 33 254996 sdc1
sh-3.00# cat /proc/partitions | grep sdc
8 32 255232 sdc
8 33 254996 sdc1
sh-3.00# disktype /dev/sdc
--- /dev/sdc
Block device, size 30.56 MiB (32047104 bytes)
FAT16 file system (hints score 5 of 5)
Volume size 30.49 MiB (31967232 bytes, 15609 clusters of 2 KiB)
Volume name ""
sh-3.00# cat /proc/partitions | grep sdc
8 32 31296 sdc
(remove /dev/sdc media)
sh-3.00# cat /proc/partitions | grep sdc
8 32 31296 sdc
sh-3.00# disktype /dev/sdc
--- /dev/sdc
disktype: Can't open /dev/sdc: No medium found
sh-3.00# cat /proc/partitions | grep sdc
sh-3.00# cat /proc/partitions
major minor #blocks name
7 0 67144 loop0
7 1 524288 loop1
7 3 8524 loop3
7 4 61236 loop4
22 64 78150744 hdd
22 65 4096543 hdd1
22 66 6136830 hdd2
22 67 2859570 hdd3
22 68 1 hdd4
22 69 771088 hdd5
22 70 8570646 hdd6
22 71 55030626 hdd7
22 72 682731 hdd8
8 0 156290904 sda
8 1 66557263 sda1
8 2 2048287 sda2
sh-3.00#
sh-3.00# disktype /dev/sdc
--- /dev/sdc
disktype: Can't open /dev/sdc: No medium found
(insert 256MB)
sh-3.00# cat /proc/partitions | grep sdc
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 159 94 2024 2480 0 0 0 0 0 1950 2480
sh-3.00# disktype /dev/sdc
--- /dev/sdc
Block device, size 249.3 MiB (261357568 bytes)
DOS partition map
Partition 1: 249.0 MiB (261115904 bytes, 509992 sectors from 56, bootable)
Type 0x06 (FAT16)
FAT16 file system (hints score 5 of 5)
Volume size 248.8 MiB (260841472 bytes, 63682 clusters of 4 KiB)
Volume name ""
Ext3 file system
UUID 5E93D6C6-44E3-4732-8D25-FB1CCDB7D88E (DCE, v4)
Volume size 249.3 MiB (261357568 bytes, 255232 blocks of 1 KiB)
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 175 97 2176 2730 0 0 0 0 0 2130 2730
8 33 sdc1 0 0 0 0
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 175 97 2176 2730 0 0 0 0 0 2130 2730
8 33 sdc1 0 0 0 0
sh-3.00# cat /proc/partitions | grep sdc
8 32 255232 sdc
8 33 254996 sdc1
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc1|vfat|509992
(remove /dev/sdc media)
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc1|none|509992
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc|none|0
/dev/sdc1|none|0
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc|none|0
/dev/sdc1|none|0
sh-3.00# cat /proc/partitions | grep sdc
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc|none|0
/dev/sdc1|none|0
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 178 106 2272 2790 0 0 0 0 0 2190 2790
8 33 sdc1 8 64 0 0
sh-3.00# disktype /dev/sdc
--- /dev/sdc
disktype: Can't open /dev/sdc: No medium found
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 178 106 2272 2790 0 0 0 0 0 2190 2790
8 33 sdc1 8 64 0 0
sh-3.00# cat /proc/partitions | grep sdc
(insert 32MB)
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 178 106 2272 2790 0 0 0 0 0 2190 2790
8 33 sdc1 8 64 0 0
sh-3.00# cat /proc/partitions | grep sdc
sh-3.00# disktype /dev/sdc
--- /dev/sdc
Block device, size 30.56 MiB (32047104 bytes)
FAT16 file system (hints score 5 of 5)
Volume size 30.49 MiB (31967232 bytes, 15609 clusters of 2 KiB)
Volume name ""
sh-3.00# cat /proc/partitions | grep sdc
8 32 31296 sdc
sh-3.00# cat /proc/diskstats | grep sdc
8 32 sdc 188 107 2360 2950 0 0 0 0 0 2290 2950
sh-3.00# ./probepart-bk4 | grep sdc
/dev/sdc|vfat|62592
sh-3.00#
Jesse