It is currently Sat May 25, 2013 9:18 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed Apr 25, 2007 4:31 am 
Regular Zenwalker
Regular Zenwalker
User avatar

Joined: Tue Apr 10, 2007 11:39 am
Posts: 27
Hi Zenwalk gang,

I want to set up my usb external disk to have the same mount point everytime it is plugged in, or upon boot if it is already plugged in. I have read up on the net about the LABEL option in fstab and it seems the best option for me, ie namely that it is human readable, and it looks like the label isn't affected when partitions are altered, unlike UUID's. Despite all my reading I am having trouble, because it won't follow the rule I have placed in fstab, and is just mounting the partitions as 'usb' and 'usb1'.

I have created the label on the external drive as 'cm1' for the 1st partition, and 'cm2' as the 2nd partition. The results of blkid are:
  /dev/sdb1: LABEL="cm1" UUID="76657782-3c6c-4fd8-a2e0-1ecc3772f476" TYPE="ext2"
  /dev/sdb2: LABEL="cm2" UUID="d1e29e9f-5ef5-4dfc-b7f1-7ef7faedf21e" TYPE="ext2"

I have created directories in /mnt as cm1 and cm2 for the partitions to get mounted on to:
  drwxr----- 2 fiery  users  4096 2007-04-25 12:37 cm1
  drwxr----- 2 fiery  users  4096 2007-04-25 12:37 cm2

I have updated fstab with the following:
  LABEL=cm1    /mnt/cm1        ext2    defaults            1  0
  LABEL=cm2    /mnt/cm2        ext2    defaults            1  0

If I use the command 'mount -l', I can see that the drives are automounting at usb and usb1 instead of cm1 and cm2, even though at the end of the entries you can see that the system appears to be recognising the label, ie the [cm1] part .
  /dev/sdb1 on /mnt/usb type ext2 (rw,nosuid,nodev,sync,dirsync) [cm1]
  /dev/sdb2 on /mnt/usb1 type ext2 (rw,nosuid,nodev,sync,dirsync) [cm2]

So the system is seeing the label, however it is not matching it up with the lines in fstab, possibly because I have missed something?

But if I unmount the drives and remount them manually (ie mount LABEL=cm1), it works! So how do I get it to work automatically?

Any ideas? If someone can help me understand and work through this, I promise I'll add it to the wiki for others.  ;)

Cheers,

My reading material (amongst others):
http://wiki.archlinux.org/index.php/Per ... g#In_fstab
http://ubuntuforums.org/showthread.php?t=283131

_________________
ThinkZen member #004
Proud Thinkpad Zenwalker - Yeah baby!


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed Apr 25, 2007 10:20 am 
Community Packager
Community Packager
User avatar

Joined: Fri Mar 10, 2006 3:52 am
Posts: 690
I can't help you with the way you’re trying to do this, but I managed to get persistent naming of my USB drive by writing a udev rule.  See this thread:
http://support.zenwalk.org/index.php/topic,7615.0.html

Note that this is on Zenserver.  If you’re running Zenwalk, then have you tried using hotname in Zenpanel??

_________________
"You are the proud owner of the very first purchased official Zenwalk CD with official Zenwalk artwork!"  Axxium March 10, 2006


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed Apr 25, 2007 6:43 pm 
Experienced Zenwalker
Experienced Zenwalker

Joined: Thu May 25, 2006 4:02 pm
Posts: 135
Location: Grenoble - France
Very good, thank for the tip laprjns.

an easier way to change the name of a device would be with thunar : rigth clic -> rename.
but it doesn't work.


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Sun Apr 29, 2007 8:47 am 
Regular Zenwalker
Regular Zenwalker
User avatar

Joined: Tue Apr 10, 2007 11:39 am
Posts: 27
Hey laprjns,

Thanks for the info. I am running indeed running Zenwalk, however didn't know about the hotname/automount option in Zenpanel due to the fact that I could not get Zenpanel working upon install (see http://support.zenwalk.org/index.php/to ... l#msg44795).

I've just had a look in the manual (http://manual.zenwalk.org/en/ch04s01.html) to find out more about hotname, and yeah I agree, it is probably easier to do this it this way, especially since the manual mentions that it is better not to setup automount via fstab.

I hadn't fixed zenpanel as I wasn't ready yet to start playing with snapshot, but I guess now is as good a time as ever!

_________________
ThinkZen member #004
Proud Thinkpad Zenwalker - Yeah baby!


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed May 02, 2007 4:22 am 
Regular Zenwalker
Regular Zenwalker
User avatar

Joined: Tue Apr 10, 2007 11:39 am
Posts: 27
OK, so I got Zenpanel working today after updating glibc and systemtools from snapshot. I can now get into Zenpanel, and from there into Mountpoint Names. And yes, I was able to add change the default mountpoint names to those of my choosing. Very convenient and user friendly! :)

One thing I have noticed though is that I can no longer right click the usb drive and 'Safe Unplug' the device. This option is no longer there and there is no other to chose. Is it possible that this is because I am mixing and matching ZW 4.4.1 and the couple of packages from snapshot? Anyway, I am using the sync command in terminal prior to unplugging the devices, so I am still safe unplugging, only manually.

Cheers,

_________________
ThinkZen member #004
Proud Thinkpad Zenwalker - Yeah baby!


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed May 02, 2007 6:03 am 
Administrator
Administrator
User avatar

Joined: Fri Mar 10, 2006 8:52 am
Posts: 3731
Location: Nantes - France
You will have to edit the Thunar custom actions, to add a filename pattern for the Safe unplug action.

Cheers

JP

_________________
A gentleman is someone who can code java, but doesn't..


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed May 02, 2007 6:59 am 
Regular Zenwalker
Regular Zenwalker
User avatar

Joined: Tue Apr 17, 2007 1:34 pm
Posts: 22
Or use a name with "usb". My partitions of my usb hard disk are named usb-DD1 and usb-DD2 (DD for disque dur, hard disk in french...) and I have no problem to "unplug".

Patrick


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Wed May 02, 2007 10:33 am 
Community Packager
Community Packager
User avatar

Joined: Fri Mar 10, 2006 3:52 am
Posts: 690
From the manual:
Quote:
2.4. Choice of names
The tool will not allow you to enter an invalid name. If the automount system finds that two devices want the same name, then the first to be seen gets the preferred name, and the second gets the usual generic name, like "usb1".

The Safe Unplug right-click Thunar action will, by default, not appear if the name of the mountpoint does not begin with a standard prefix: usb, fire, pcm, mmc. Since you will want to use this action, you should either add your choice of name to the its appearance conditions (or put a * there, meaning all names), or use a standard prefix on your name, e.g. usb-camera.


I use usb_bluestick, usb_graystick and usb_blackstick for hotnames.  Works great.

Rich

_________________
"You are the proud owner of the very first purchased official Zenwalk CD with official Zenwalk artwork!"  Axxium March 10, 2006


 Profile Send private message  
 
 Post subject: Re: Persistant naming of USB drive using LABEL in fstab
PostPosted: Thu May 03, 2007 12:16 am 
Regular Zenwalker
Regular Zenwalker
User avatar

Joined: Tue Apr 10, 2007 11:39 am
Posts: 27
Hey Patrick / Rich / Gang,

Yeah, I'm a lazy type of person so didn't want to prefix everything with 'usb', as it will hinder me from being able to use tab to autocomplete when using the command line.  ;)

My external drive (in a cooler master case, hence the cm1 and cm2 names) is split into a couple of partions at the moment, one for my photo's and my cd collection which I am currently backing up in flac, and the other partition for backups of my laptop, ie / and /home etc. Since I want to name both with the same cm prefix, I have been able to add my own 'cm' rule to Thunar as per JP's hint. There is some info here http://thunar.xfce.org/pwiki/documentat ... om_actions, but basically I did the following:

1) Open Thunar
2) Open the 'Edit' menu, then choose 'Configure custom actions...' (this will bring up the Custom Actions box).
3) Double-click 'Safe unplug' to open the 'Edit actions' box, and then choose the 'Appearance Conditions' tab. You can add your own prefix in 'File Patterns', eg once I added my cm prefix it looked like this:
  cm*;usb*;fire*;pcm*;mmc*

It's cool because I didn't realise Thunar could do this. I guess it's not such a basic file manager after all!  :)

Cheers,

_________________
ThinkZen member #004
Proud Thinkpad Zenwalker - Yeah baby!


 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
 
cron