Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Hardware & Laptops
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Hardware & Laptops
Problems with hardware & laptops not being detected or supported during or after install.

 
 
Thread Tools Display Modes
Old March 13th, 2007   #1
Blazeix
A Carafe of Ubuntu
 
Join Date: Mar 2006
Location: U.S.A.
Beans: 84
Gutsy Gibbon Testing
Permanent Mount Location

Hi,

Is there a way to make a certain hard drive always mounts to the same place? I have three usb devices (2 external hard drives and a thumb drive). Right now, my hard drive will mount as usbdisk, usbdisk-1, or usbdisk-2, depending on which items were plugged in first. I have programs that access files on my external hard drive, and I am always having to change the path where they look depending on what the hard drive mounts as. Is there a way to make it so that if my hard drive is attached, it always mounts in the same place? Thanks.

I'm running Ubuntu Edgy.

Last edited by Blazeix; March 14th, 2007 at 01:30 AM..
Blazeix is offline  
Old March 14th, 2007   #2
Dr. Nick
Tall Cafè Ubuntu
 
Dr. Nick's Avatar
 
Join Date: Oct 2005
Location: Heart of Texas
Beans: 2,655
Ubuntu 9.04 Jaunty Jackalope
Re: Permanent Mount Location

Never done this before, but if you didnt know /etc/fstab is what controls mount locations

Look here for some ideas, post 12 looks like it could work
http://ubuntuforums.org/showthread.php?p=1659569
Dr. Nick is offline  
Old March 14th, 2007   #3
Blazeix
A Carafe of Ubuntu
 
Join Date: Mar 2006
Location: U.S.A.
Beans: 84
Gutsy Gibbon Testing
Re: Permanent Mount Location

Thanks, that forum post you pointed me to clued me in on several important 'vocab words' which I was then able to Google and figure out how to do it. I figured I would post it here in case other users are looking for how to do it.

This is a useful site that helped me figure out how to do this: http://reactivated.net/writing_udev_rules.html#builtin

From the above site:
Quote:
udev provides persistent naming for some device types out of the box.
This was exactly what I was looking for. Basically, if you look at the /dev/disk/by-* directories, you will see several symbolic links. For example, if I use ls -Z in /dev/disk/by-id I see this
Code:
$ ls -Z /dev/disk/by-id
lrwxrwxrwx  root     root                   scsi-1ATA_HTS726060M9AT00_MRH436M4H -> ../../sda
lrwxrwxrwx  root     root                   scsi-1ATA_HTS726060M9AT00_MRH436M4H-part1 -> ../../sda1
lrwxrwxrwx  root     root                   scsi-1ATA_HTS726060M9AT00_MRH436M4H-part2 -> ../../sda2
lrwxrwxrwx  root     root                   scsi-1ATA_HTS726060M9AT00_MRH436M4H-part3 -> ../../sda3
lrwxrwxrwx  root     root                   scsi-1ATA_HTS726060M9AT00_MRH436M4H-part4 -> ../../sda4
lrwxrwxrwx  root     root                   usb-Maxtor_4_A250J0_DEF10A8BC3D5 -> ../../sdc
lrwxrwxrwx  root     root                   usb-Maxtor_4_A250J0_DEF10A8BC3D5-part1 -> ../../sdc1
lrwxrwxrwx  root     root                   usb-SanDisk_U3_Titanium_0000185E79605C7B -> ../../sdb
lrwxrwxrwx  root     root                   usb-SanDisk_U3_Titanium_0000185E79605C7B-part1 -> ../../sdb1
I knew that the disk I was interested in was sdc1 (I figured this out using "fdisk -l"). This part of this disk corresponds with "usb-Maxtor_4_A250J0_DEF10A8BC3D5-part1." I put the following entry in my fstab after creating the directory /media/external1:
Code:
# Always mount this drive to this folder
/dev/disk/by-id/usb-Maxtor_4_A250J0_DEF10A8BC3D5-part1  /media/external1        ext3     defaults,user         0       0
As you can see, I'm using the symbolic link usb-Maxtor_4_A250J0_DEF10A8BC3D5-part1 to reference my hard drive, and mounting it in /media/external1. Since the filesystem of my drive is ext3, I specified this as the third argument. I used the options 'defaults,users' to make it so non-root users could mount the disk. If you have a different filesystem, like fat32, you might need to change the options (I'm not sure). I saved fstab, and rebooted. I've rebooted several times with various configurations of usb devices attached, and so far it has worked every time. Thanks!

Last edited by Blazeix; March 28th, 2007 at 12:47 AM..
Blazeix is offline  
Old March 14th, 2007   #4
Dr. Nick
Tall Cafè Ubuntu
 
Dr. Nick's Avatar
 
Join Date: Oct 2005
Location: Heart of Texas
Beans: 2,655
Ubuntu 9.04 Jaunty Jackalope
Re: Permanent Mount Location

yeah, if the partition was fat32 it would be vfat, ntfs for ntfs.

I had played with fstab in the past, but never tried what you did.

Thanks for making the write up. You may consider posting it to the tips forum.
Dr. Nick is offline  
Old February 19th, 2008   #5
rare HERO
Just Give Me the Beans!
 
rare HERO's Avatar
 
Join Date: Aug 2007
Location: rarehero.com
Beans: 47
Ubuntu 9.04 Jaunty Jackalope
Send a message via AIM to rare HERO Send a message via MSN to rare HERO Send a message via Yahoo to rare HERO
Re: Permanent Mount Location

Seems like there is a step missing. I don't understand what you did:

Code:
$ always mount this drive to this folder /dev/disk/by-id/scsi-1ATA_HTS541080G9SA00_MPBDP0XKKPLYUM-part2 /media/drive29 fat32 defaults,user 0 0
bash: always: command not found

Whats the command?


Figured it out. This post helped me:
http://ubuntuforums.org/showthread.php?t=432659
__________________
rare HERO BLOG

Last edited by rare HERO; February 19th, 2008 at 06:24 PM.. Reason: Updated what I had done.
rare HERO is offline  
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:35 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry