212,213b USB flash names not retained in Pmount, Univ Inst
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