Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

After much digging around I've found a way to share my NTFS drives, but I don't know how to do it so it will still remain active after I restart the computer.

This is the method I currently use:

First, I unmount the drive (Since ubuntu mounts it on start-up)

then I open the terminal and use the following command: sudo /sbin/mount.ntfs /dev/sdc1 /media/Expansion -o rw,auto,user,fmask=0111,dmask=0000

Then finally, if necessary, I start a share manually using the GUI and tick the 'guest access' box. This stage is usually not necessary.

This method works for me, but I have to do it every time after I restart the computer.

I think the only problem is that the mount on start-up does not set NTFS permissions to grant access from the network, and the command I use does (I don't understand the command, I copy pasted it from a forum post and edited it to my needs, and I'm guessing 'fmask=0111' or 'dmask=0000' gives the permissions)

I'm thinking of adding a shell script with this command to /etc/init.d but I fear that might not be a very 'neat' way to do it. Also, I will need to find a way to deactivate whatever mounts the drive currently on-startup.

Any help or better ideas?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can enter the drive into /etc/fstab. This is the place, where all volumes to be mounted permanently go (i.e. your system disk as well).

Just add the line: /dev/sdc /media/Expansion ntfs rw,auto,fmask=0111,dmask=0000 0 0

or: UUID="12345566789ABCD" /media/Expansion ntfs rw,auto,fmask=0111,dmask=0000 0 0

where "12345566789ABCD" is the UUID of your disk. You can get this information with sudo blkid

You recognize some parameters from your mount command here.

  1. /dev/sdc1 - is the device file, a unabstracted representation of the partition as it appears to the file system driver (the "block device")
  2. /media/Expansion - is the Directory in which the drives content will be made available (the "mount point")
  3. ntfs - guess what, it's the filesystem driver to use.
  4. rw,auto,... - this is a list of mount options
    • rw - mounts the volume for read/write access
    • auto - mount the volume automatically if needed
    • fmask=0111 - well this is more complicated, without explaining it in detail: it helps the system define file permissions on the volume, since ntfs does not normally store Linux- (Posix-)permissions
    • dmask=... - same here for directories
    • user - allows a mere user to mount and unmount the volume without using sudo, since you specified auto (which keeps the volume mounted anyway) this should not be required
  5. 0 0 - Those parameters have to do with system maintanance jobs like error checking the volume on startup, see man 5 fstab if you want to learn more

PLease note, that this is completely independet of the "share volume"/"guest access" stuff, but since you said, you don't need to normally do that anyway, I thought you might want to care about mounting the volume first.

share|improve this answer
    
That didn't work. I believe that the problem is that ubuntu mounts all external drives automatically and I can't mount it twice. I need to find a way to either unmount it at start-up, or, better yet, have ubuntu not mount it in the first place. I'm going to try to find out how to do it, if you know how or have any tips, I'll be happy to hear from you. tnx –  Tom Nov 2 '12 at 10:38
    
The problem was actually not caused because ubuntu mounted it automatically. I'm not sure what did, but I fixed it by using the UUID on fstab instead of /dev/sdc –  Tom Nov 2 '12 at 11:11
    
Oh, yes, of course /dev/sdc1 would have been correct, like in the command line call from your question. But using the UUID is better anyway, because it is independent from the order in which disks are initialized. Thanks for editing. –  Paul Hänsch Nov 2 '12 at 12:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.