Results 1 to 4 of 4
Please can I have some suggestions as to how one could determine (for use in a Bash or Python script) which device (eg /dev/sda1, /dev/hda1... etc) a ramfs was loaded ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-22-2010 #1
After USB boot, detect which device the ramfs was loaded from. Bash or Python
I have a RIPLinux/Tinycore live USB disk that automatically needs to run a script that is stored on the same USB drive but not part of the RIPLinux/Tinycore image. (Please note that I do not want to put this script into the RIPLinux image.) I therefore would like to remix the RIPLinux/Tinycore ISO to automatically run this script once it has started up. After RIP linux has booted I would like to automatically mount the USB drive that RIPLinux/Tinycore was booted from. I need help detecting which device this is.
Thanks in advance
Last edited by RobertF; 09-22-2010 at 09:31 AM.
- 09-22-2010 #2
So far my best solution is mounting each existing device and looking for the install script. If not found, then move on to the next device.
Any better suggestions?
- 09-22-2010 #3
Ok... Disk labels might work. Duh (hopefully)
- 09-27-2010 #4
Right on gentoo, to create a labeled fat32 USB disk use sys-fs/mtools (install: #emerge mtools)
To label the partition on the USB disk use command:
#mlabel -i /dev/partition ::my_label
Where partition is the partition name ie. sda1, hda1 etc that you want to label and my_label is the label you want to use for the partition.
Now to mount the partition using the label instead of the device name use the following command:
#mount /dev/disk/by-label/my_label /mnt/my_mountpoint
Sorted, Problem solved. Please let me know if there is a better way of doing this.