LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2009, 11:56 AM   #1
gwagchunks
LQ Newbie
 
Registered: Jul 2009
Location: UK
Distribution: Ubuntu
Posts: 2

Rep: Reputation: 0
Help to understand how to automount a usb ntfs hard drive


Hi everyone

(Using ubuntu 9.04)
Sorry to post this one up, but I've have googled and still don't quite understand fstab and I really don't want to trash my system! I have an external usb hard drive I want to automount on bootup / startup. Not 100% sure of the best / safest way: here is some info on my drives

Code:
sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x35073506

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       12748   102398278+   7  HPFS/NTFS
/dev/sda2           12749       14207    11719417+  83  Linux
/dev/sda3           14208       60801   374266305    5  Extended
/dev/sda5           14208       14331      995998+  82  Linux swap / Solaris
/dev/sda6           14332       60801   373270243+  83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xddfe77c0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121601   976760001    7  HPFS/NTFS


rich@htpc:~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             11535376   1929492   9019916  18% /
tmpfs                  1030344         0   1030344   0% /lib/init/rw
varrun                 1030344       328   1030016   1% /var/run
varlock                1030344         0   1030344   0% /var/lock
udev                   1030344       176   1030168   1% /dev
tmpfs                  1030344         0   1030344   0% /dev/shm
lrm                    1030344      2392   1027952   1% /lib/modules/2.6.28-11-generic/volatile
/dev/sda6            373139168   1175216 371963952   1% /var/lib

*** ONCE MOUNTED THROUGH FILE MANAGER AND RUNNING DF AGAIN HERE IS THE DRIVE ***

/dev/sdb1            976760000  11307200 965452800   2% /media/Mybook

Here is my fstab file

# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda2 during installation
UUID=af994ff2-a9b8-4977-b0ca-734b7ea56d93 /               ext3    errors=remount-ro 0       1
# /var/lib was on /dev/sda6 during installation
UUID=01cad37d-b1d5-4ec5-b107-e5af973da68c /var/lib        xfs     defaults        0       2
# swap was on /dev/sda5 during installation
UUID=537acc4a-eaf5-4d5f-bfa7-8af67666d63f none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
So the drive is a NTFS drive (I know,sorry!!!) and it's /dev/sdb1 and label is /media/Mybook

Thanks every so much.
 
Old 07-31-2009, 01:28 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Well, if the device is always going to be at /dev/sdb1 (Think hard about what I am suggesting here).
You could put this in your /etc/fstab
Code:
/dev/sda2       /mnt/wherever        ntfs-3g defaults
Otherwise you might be better off mounting by UUID
Code:
UUID=7591fe5b-8907-406f-854e-321684957104 /mnt/wherever        ntfs-3g defaults
Obviously, your UUID will be different from mine.

Or use the LABEL:
Code:
LABEL=Mybook   /mnt/wherever        ntfs-3g defaults
See here: http://wiki.linuxquestions.org/wiki/Fstab

The directory /mnt/wherever needs to exist and have appropriate permissions for your security policy. Perms = 777 if you don't care who can read / write the drive. Eg (as root)
Code:
mkdir /mnt/Mybook
chmod 777 /mnt/Mybook
Before you try mounting the drive.

As usual with linux, there are many ways to achieve what you need.

udev is great for handling this sort of thing (especially if you have multiple drives / USB things that you want to plug in and out, and always have them appear at a sensible, known mountpoint).

See here: http://www.reactivated.net/writing_udev_rules.html

Have fun and welcome to LQ!
 
Old 07-31-2009, 02:57 PM   #3
gwagchunks
LQ Newbie
 
Registered: Jul 2009
Location: UK
Distribution: Ubuntu
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks Tredegar

Thanks for excellent reply! It has helped a lot. I have used the first suggestion in the post and it automounts perfectly. I will get around to using the uuid as I will probably add more drive in the future. Changing the permissions to enable sharing with other computers was a good call as well, I had not thought of that but I will probably do that in the near future. Thanks again!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automount usb hard drive at startup kutlu Debian 8 01-05-2009 02:31 AM
USB NTFS Hard Drive / Debian grapnell Linux - Hardware 1 08-12-2006 06:26 AM
getting an NTFS USB hard drive working in MoviX phileblunt86 Linux - Newbie 2 07-15-2006 04:57 PM
Debian usb ntfs hard drive problem hutch Debian 4 09-28-2005 10:33 PM
USB hard disk drive, using NTFS Barney_cc Linux - Hardware 1 09-02-2003 03:53 AM


All times are GMT -5. The time now is 08:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration