Page 1 of 1

Rpi2 renaming Flash?

Posted: Mon Jun 15, 2015 7:08 pm
by henryhanselscott
So sometimes when an unexpected power failure happens with my pi and it has a USB flash inserted into it, it renames my flash. For instance, the flash is named 'FRED' using the Windows utility when you right click a drive and assign it a name. When being used in the pi, if power fails then on reboot when I navigate to the drive using File Manager the drive is now shown as 'FRED_' with an underscore attached to it. Putting this same drive back into a windows machine it shows up as just 'FRED'. The issue is that my Python code cannot find 'FRED' anymore and my script crashes.

Thanks,
Henry

Re: Rpi2 renaming Flash?

Posted: Mon Jun 15, 2015 7:26 pm
by DougieLawson
Use blkid to find the UUID for the drive, add a permanent mount for it in /etc/fstab.

Code: Select all

UUID=uuuu-uuuu-uuuu /media/FRED     xxxx    defaults,noatime        0 1
with uuuu-uuuu-uuuu as the UUID (from blkid) and xxxx as the filesystem type (fat32, ext4, ntfs or ntfs-3g) depending what's on your drive.

Re: Rpi2 renaming Flash?

Posted: Mon Jun 15, 2015 11:28 pm
by Tom_A
DougieLawson wrote:Use blkid to find the UUID for the drive, add a permanent mount for it in /etc/fstab.

Code: Select all

UUID=uuuu-uuuu-uuuu /media/FRED     xxxx    defaults,noatime        0 1
with uuuu-uuuu-uuuu as the UUID (from blkid) and xxxx as the filesystem type (fat32, ext4, ntfs or ntfs-3g) depending what's on your drive.
You know, I've been trying to use something similar to make my USB root partition mount by UUID instead of /dev/sda1. I worked when I was running RaspBMC, but I've never gotten it to work with Raspbian.

Re: Rpi2 renaming Flash?

Posted: Tue Jun 16, 2015 12:40 am
by shadowofdarkness
Does the FRED directory already exist before plugging the drive in. Because a extra underscore usually is only added if the directory already exists under /media so can't be used.

Re: Rpi2 renaming Flash?

Posted: Tue Jun 16, 2015 10:36 am
by henryhanselscott
Does the FRED directory already exist before plugging the drive in
Not sure what you mean exactly...but the mythical "FRED" directory exist only on the USB flash. With the drive in one of the USB ports and then after an abrupt power loss on reboot, the drive now is "FRED_ " using file manager to look at it. Python can no longer find my original "FRED" directory and so it crashes.

So its like the OS sees 2 instances of "FRED" and renames one of them to "FRED_"?

Henry