USB Flash or USB HD ???
- LazY Puppy
- Posts: 1934
- Joined: Fri 21 Nov 2014, 18:14
- Location: Germany
USB Flash or USB HD ???
Hi.
Is there a way in shell script of how to find out if a external drive is usb flash or usb hd ?
Thanks.
Is there a way in shell script of how to find out if a external drive is usb flash or usb hd ?
Thanks.
RSH
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
Re: USB Flash or USB HD ???
for some reason, lsusb isnt working in tahr. otherwise i would suggest you start here:
that will list the things you have plugged in to usb. from there, im not sure how "automatic" you can make it.
you could try looking for "xternal" but for example, if you plug in a Sandisk Cruzer it doesnt say "flash drive" it says the name and model. you may know a Cruzer is a flash drive not an external, but that doesnt make anything easy for you.
do let me know if lsub works in your version of puppy.
this isnt a lot better:
Code: Select all
lsusb | egrep -v "root hub|Mouse|Keyboard"
you could try looking for "xternal" but for example, if you plug in a Sandisk Cruzer it doesnt say "flash drive" it says the name and model. you may know a Cruzer is a flash drive not an external, but that doesnt make anything easy for you.
do let me know if lsub works in your version of puppy.
this isnt a lot better:
Code: Select all
find /sys/devices/ | egrep "roduct|eviceClass" | xargs cat | sort | uniq
Re: USB Flash or USB HD ???
Works for me.learnhow2code wrote:for some reason, lsusb isnt working in tahr.
- LazY Puppy
- Posts: 1934
- Joined: Fri 21 Nov 2014, 18:14
- Location: Germany
All of this doesn't have info about being usb hd or usb flash.
I wonder how Puppy handles this as its behavior on a pup save is different on usb hd and usb flash (pupmode 12 & 13).
Or is this different behavior just dependent on the value of PUPMODE= ???
I wonder how Puppy handles this as its behavior on a pup save is different on usb hd and usb flash (pupmode 12 & 13).
Or is this different behavior just dependent on the value of PUPMODE= ???
RSH
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
correct.LazY Puppy wrote:All of this doesn't have info about being usb hd or usb flash.
then we should have a look at the code. you dont know where to find the files for pup save do you? (or the filename of the program?)I wonder how Puppy handles this as its behavior on a pup save is different on usb hd and usb flash (pupmode 12 & 13).
my first guess was about partition types, but your guess is great.Or is this different behavior just dependent on the value of PUPMODE= ???
if you help me find the files//programs in question, i will be happy to check their code out.
- LazY Puppy
- Posts: 1934
- Joined: Fri 21 Nov 2014, 18:14
- Location: Germany
Probably /etc/rc.d/rc.shutdown ?
Or /usr/sbin/shutdownconfig ?
At least I had modifications on these files to shutdown without option to create a save file at all.
Or /usr/sbin/shutdownconfig ?
At least I had modifications on these files to shutdown without option to create a save file at all.
RSH
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
thanks.LazY Puppy wrote:Probably /etc/rc.d/rc.shutdown ?
Or /usr/sbin/shutdownconfig ?
so im doing this:
cat /etc/rc.d/rc.shutdown | cat -n | grep SAVE
theres a lot of stuff.
this could be a good time to talk more about what youre trying to accomplish. im not sure puppy actually knows whether a drive is usb or usb external, per se. it may know similar information that helps it do something specific.
so what specifically do you want to know for? that might make it easier to find a solution or way around this.
-
- Posts: 1543
- Joined: Mon 22 Feb 2016, 19:43
so perhaps running env would provide something lp is looking for?Sailor Enceladus wrote:I just use "pmedia=ataflash" on both flash stick and hard drive so I can get a save icon. On my dads desktop to boot from flash stick you have to select USB HDD and not USB FDD in the Bios menu as FDD apparently means 1.44MB USB Floppy drive - lol.
- LazY Puppy
- Posts: 1934
- Joined: Fri 21 Nov 2014, 18:14
- Location: Germany
The term 'external' is somehow useless or not needed. Main cause is usb flash or usb hd.this could be a good time to talk more about what youre trying to accomplish. im not sure puppy actually knows whether a drive is usb or usb external, per se. it may know similar information that helps it do something specific.
so what specifically do you want to know for? that might make it easier to find a solution or way around this.
I would like to make my installer script modifying/preparing the preset of menu.lst file automatically for pmedia=usbflash or pmedia=usbhd after installing.
RSH
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:
No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:
ive probably spent an hour or two on this, and im not convinced (except for the functionality in puppy, which could be just a user-set variable) that its possible to do what you want.
this is only after a lot of looking. maybe its out there. theres a bash script by gregkh of systemd fame, that is included in devuan anyway, called usb-devices. honestly, most of these "list usb" programs are going to return similar information--
comparing thumb drives and externals with various utilities, im not finding a rule that wouldnt require a table of all possible devices (paried with info on whether they are external or not.) you can try looking through the output of usb-devices, lsusb, and udisks --dump but dont get excited. i thought grepping for ata might help. udisks says the thumb drive has "rotational media" but we know that isnt the case. udisks2 isnt more helpful.
i havent only been looking for stuff on listing usb and drive info. no, ive spent a lot of time looking for external drives udisks, determine external, i can show you a link on how to figure it out in c# on windows... not pertinent to your question.
at the top of that page they say it isnt possible to tell an enclosure from a thumb drive. but if you find a way, id love to read your post about it. im sure the computer knows, but we are trying to find an easy-to-use interface. does puppy really know without asking the user?
this is only after a lot of looking. maybe its out there. theres a bash script by gregkh of systemd fame, that is included in devuan anyway, called usb-devices. honestly, most of these "list usb" programs are going to return similar information--
comparing thumb drives and externals with various utilities, im not finding a rule that wouldnt require a table of all possible devices (paried with info on whether they are external or not.) you can try looking through the output of usb-devices, lsusb, and udisks --dump but dont get excited. i thought grepping for ata might help. udisks says the thumb drive has "rotational media" but we know that isnt the case. udisks2 isnt more helpful.
i havent only been looking for stuff on listing usb and drive info. no, ive spent a lot of time looking for external drives udisks, determine external, i can show you a link on how to figure it out in c# on windows... not pertinent to your question.
at the top of that page they say it isnt possible to tell an enclosure from a thumb drive. but if you find a way, id love to read your post about it. im sure the computer knows, but we are trying to find an easy-to-use interface. does puppy really know without asking the user?
@LazY Puppy
Have you tried lsblk? Maybe it's of help.
Change sdc1 to what ever you drive is.
(BTW the -o above is a lower case letter o, not a zero).
If the output gives a RM and a 1, then it's removable if it's a zero, then it's not.
If you just a 1 or 0 just pipe it thru grep:
Each drive has a removable flag (set or not) but be aware that not all USB sticks/flash drives report this correctly.
Have you tried lsblk? Maybe it's of help.
Code: Select all
lsblk -b /dev/sdc1 -o RM
(BTW the -o above is a lower case letter o, not a zero).
If the output gives a RM and a 1, then it's removable if it's a zero, then it's not.
If you just a 1 or 0 just pipe it thru grep:
Each drive has a removable flag (set or not) but be aware that not all USB sticks/flash drives report this correctly.
Last edited by Pete on Thu 23 Jun 2016, 11:16, edited 1 time in total.
Right, did some more snooping around and you can use:
You should get a 1 = yes, removable or 0 = not removable.
Adjust sdc to suit yours.
BIG NOTE:
Be careful as some USB flash drives report themselves as fixed even though they are not.
Something to do with Win 8 certification.
Code: Select all
cat /sys/block/sdc/removable
Adjust sdc to suit yours.
BIG NOTE:
Be careful as some USB flash drives report themselves as fixed even though they are not.
Something to do with Win 8 certification.