Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 11 Dec 2019, 07:55
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Mount a drive by UUID?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
greengeek


Joined: 20 Jul 2010
Posts: 5624
Location: Republic of Novo Zelande

PostPosted: Mon 28 Oct 2013, 10:37    Post subject:  Mount a drive by UUID?  

On my PC I have my music files on a usb stick that usually shows as sdc2 but 10% of the time shows up as sdd2 (this seems to be a legacy of the fact that this usb stick is hanging off a 7-port usb adapter, which is hanging off a pcmcia usb2 adapter card so detection time seems to vary a bit). I am wanting to automate the playing of the music files after boot (by setting it up to be automounted - there are various methods for this and I haven't decided which is the best option yet...) but cannot do so if the drive designation is varying.


The answer seems to be to use the UUID of the usb stick to identify it, and mount it using that UUID. I can find the UUID but I don't know WHERE/HOW to mount it. I can't afford to mount it as sdc2 because some other drive will probably be occupying that designation. The command I have found via google suggests to add the following to the fstab:
Code:
UUID=9263eae3-bdba-4707-89bb-a8e0fd4a1c29   /mnt/backups   ext3  defaults   0 0


But does puppy even use the fstab? I've read that puppy does not mount in the same manner that other *nixes do... Would I need to make a new directory like /mnt/music and mount the device there?

The page I'm working from is:
http://centoscert.com/content/how-mount-drive-uuid

I could fiddle around with this and give it a try (normally I'm happy to tinker) but I'm not keen to fiddle with my filesystem structure without advice from someone more experienced. Smile

I'm thinking I should not bother tinkering with the fstab, and possibly do the following:
1) create the /mnt/music directory
2) write a script to mount the uuid to that directory:
Code:
#!/bin/bash
UUID=9263eae3-bdba-4707-89bb-a8e0fd4a1c29   /mnt/music   ext3  defaults   0 0

(ok - i'm just getting this WRONG i know it)

I don't want to use startmount or other "mount-all" solutions because they still suffer from the varying designation issue - it is just how/where to mount (and what to do with the fstab) that I can't figure. And if I do mount the drive in some manner, will it appear on the desktop? And how will puppy handle it if I remove / reinstall the drive - will it merely tack it onto the string of drives as sdx? (maybe this suggests that I SHOULD put it in the fstab so puppy knows what i want done with it...?)

Comment re puppy handling of fstab here:
http://mail.murga-projects.com/puppy/viewtopic.php?t=84365&sid=2628c1e530bbf2a72a4a1f6fdde2e829

These other sites seemed useful aswell:
http://www.cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab/
http://administratosphere.wordpress.com/2011/04/02/an-easier-way-to-mount-disks-in-linux-by-uuid/
.

Last edited by greengeek on Mon 28 Oct 2013, 14:08; edited 1 time in total
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 11281

PostPosted: Mon 28 Oct 2013, 11:49    Post subject:  

mount -U {uuid} /mnt/mountpoint .... tried that?

yes fstab no worky... perhaps use the uuid as the mount point eg /mnt/{uuid}

mike
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5624
Location: Republic of Novo Zelande

PostPosted: Mon 28 Oct 2013, 14:20    Post subject:  

Thanks Mike. I just gave that (and a couple of variations) a try as follows:

mount -U {023E-C239} /mnt/music
mount -U {"023E-C239"} /mnt/music
mount -U {UUID=023E-C239} /mnt/music
mount -U {UUID="023E-C239"} /mnt/music

but in each case it came back with:

no such partition found

My blkid is as follows:
Code:
blkid
/dev/loop1: UUID="90dfda6a-fcb6-4829-8976-494387f90b82" TYPE="ext2"
/dev/sdb2: LABEL="Data ext2" UUID="0a2630d3-1bb9-4c53-81c1-4cba4a6c9342" TYPE="ext2"
/dev/sdb3: LABEL="Data fat32" UUID="45B6-2F7F" TYPE="vfat"
/dev/sda1: UUID="f68ca8aa-2d2b-4a84-ad72-7f8aae7ede62" TYPE="ext2"
/dev/sdd2: UUID="023E-C239" TYPE="vfat"
/dev/sdd3: UUID="165ec7e2-9a9d-4e83-8104-b57d511a2e9d" TYPE="swap"
/dev/sdd1: LABEL="Bootin" UUID="a88c1f47-eafe-4fd5-aad2-806ea60f5bbb" TYPE="ext2"
/dev/sdb1: LABEL="Boot" UUID="25e8c365-46d3-4899-9752-8428eb48e071" TYPE="ext2"
/dev/loop0: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/sda2: UUID="665d6c58-a16e-4bd9-aa99-bfd060629e4a" TYPE="ext2"
/dev/sda3: UUID="fc84d9dd-3fc1-4f85-aaf4-388cf723e2fa" TYPE="swap"
#


The target usb stick is sdd2 at this moment.
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 11281

PostPosted: Mon 28 Oct 2013, 14:40    Post subject:  

mount -U 023E-C239 /mnt/music

the braces were just so show to substitute the actual uuid
Sorry if that confused my annoyingly short answer Very Happy
I tried it here with a flash stick and it behaved so hopefully will solve your problem

mike
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5624
Location: Republic of Novo Zelande

PostPosted: Mon 28 Oct 2013, 15:01    Post subject:  

Champion. Working well now. Thanks!
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5087
Location: Arizona, U.S.A.

PostPosted: Mon 28 Oct 2013, 15:15    Post subject:  

I made another simple solution that uses a file in the / of the partition to ID it.

It`s nice because you can control where the link is made and the name of the link.

http://www.murga-linux.com/puppy/viewtopic.php?p=733398#733398
.
Back to top
View user's profile Send private message 
mikeslr


Joined: 16 Jun 2008
Posts: 3544
Location: 500 seconds from Sol

PostPosted: Mon 09 Dec 2013, 13:25    Post subject: Obtaining the UUID  

Hi All,

Thought this was a good place to post something fundamental about UUID's for those of us who struggle to keep up: how to get them.
Open a terminal and type "blkid" without the quotes. Thanks keef.
Of course, if you aren't able to memorize gibberish of some twenty-odd alpha-numerics, or find looking at one window while typing in another stressful, then do this instead:

Open a terminal and type

bklid > /root/my-documents/UUID.txt

which will generate a file named UUID.txt in /root/my-documents/ containing the UUID's of all the then mounted drives/partitions. Open in any text editor. Pick the right one. Copy and paste.

mikesLr

Last edited by mikeslr on Mon 09 Dec 2013, 15:35; edited 1 time in total
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14533
Location: Gatineau (Qc), Canada

PostPosted: Mon 09 Dec 2013, 14:44    Post subject:  

Hi, greengeek.

I don't know much about UUID, but here's a trick to populate fstab in Puppy.

Puppy has a minimal fstab, usually comprised of:

Code:

# Default fstab in Puppy
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
none /dev/pts devpts gid=2,mode=620 0 0
/dev/fd0 /mnt/floppy auto noauto,rw 1 1


Now a fully populated fstab is handy when you use the < mount all partitions command >:
Code:
mount -a

This command consults the fstab and mounts all partitions specified there -- instead
of you mounting each drive manually, through
the usual commands. E.g.
Code:
mount -t ext3 /dev/sda1 /mnt/sda1

or
Code:
mount -t iso9660 /dev/sr0 /mnt/sr0


The structure of the fstab file is as follows:
Quote:
# dev mnt type parameters fsck
# (fstab fields [structure])


Now to populate your fstab:

1 ) unpack the attached, make it executable and run it;

2 ) open /etc/fstab in your editor; prepare your next move by placing your cursor on
the line below the floppy disk line;

3 ) open a terminal and run
Code:
echo;cat /proc/mounts | grep "v/sd" | grep -v swap;echo

For some reason, adding ">> /etc/fstab" to the above line doesn't work.
So we have the following extra steps:

4 ) inside this terminal, with your cursor, highlight the part between the two empty
lines, and do a middle click or Shift-Delete to copy;

5 ) Alt-Tab back to your editor. Do another middle-click or Shift-Insert to paste;

6 ) You should now have your list of hard drives in fstab;

7 ) check the drives with ext* type: they should have 1 1 at the end of each line,
not 0 0. "1 1" allows them fo be checked by fsck (trick given by the e2fsprogs
author in his INSTALL file);

8 ) if you have a CD/DVD drive, after the list of hard drive partitions,
add the line (if it's not already there):
Code:
/dev/sr0 /mnt/sr0 iso9660 auto,ro 0 0

Notice the two zeros at the end. CD can't be defragged, so they don't need to have
the fsck flag up.

9 )Hit return at the bottom of the edited fstab file to make sure it has an empty line
after all the listings;

10 ) Save your newly edited fstab. (Obviously!) Smile

Next time you do a < mount -a > command, all your drives will be mounted.

As I said, I know little about UUID, but here's a little more info:
http://linux.byexamples.com/archives/321/fstab-with-uuid/
You can apparently replace the /dev/<partition> part in fstab with the UUID number.

Also here's an URL to info.com if you want to a do a more thorough search:
http://www.info.com/searchw?qkw=fstab+with+uuid&qcat=web&q=&qhqn=&KW=

Sorry if I've been a little too wordy, but I hope the above helps you somehow. BFN.

musher0
mount-all-drives2.sh.zip
Description  Derived from: der-schutzhund and SFR, http://murga-linux.com/puppy/viewtopic.php?t=84759, 2013-03-04, 10 h 47; with a few edits by me.
zip

 Download 
Filename  mount-all-drives2.sh.zip 
Filesize  790 Bytes 
Downloaded  183 Time(s) 

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Tue 10 Dec 2013, 01:45; edited 1 time in total
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5624
Location: Republic of Novo Zelande

PostPosted: Mon 09 Dec 2013, 22:52    Post subject:  

Thanks musher0. I notice BK has been incorporating UUID into his gpt boot trials lately. I'm watching with interest.
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 9093
Location: Perth, Western Australia

PostPosted: Thu 12 Dec 2013, 08:51    Post subject:  

greengeek wrote:
Thanks musher0. I notice BK has been incorporating UUID into his gpt boot trials lately. I'm watching with interest.


I do sometimes still visit this Forum!

I am using PARTUUID, not UUID, as the former is what has to be used as a kernel boot parameter.

The PARTUUID is for the partition itself, whereas the UUID (as given by blkid) is for the filesystem on the partition.

You need to use the gdisk utility to find out the PARTUUID.

_________________
https://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0

Joined: 04 Jan 2009
Posts: 14533
Location: Gatineau (Qc), Canada

PostPosted: Sat 14 Dec 2013, 13:36    Post subject:  

@greengeek:

Hi!

Would you find this of use?
http://murga-linux.com/puppy/viewtopic.php?p=743723&sort=lastpost#743723

BFN.

musher0

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)

Last edited by musher0 on Sat 14 Dec 2013, 15:48; edited 1 time in total
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5624
Location: Republic of Novo Zelande

PostPosted: Sat 14 Dec 2013, 15:39    Post subject:  

Thanks musher0. There is a lot for me to learn about how to get these things sorted out so that my puppies know what is where...
I've added your link to a couple of other similar topics so I can try to tie the information together.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0587s ][ Queries: 12 (0.0105s) ][ GZIP on ]