WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Mounting ntfs usb drives during boot using ntfs-3g  (Read 3165 times)

Offline papillon

  • Newbie
  • *
  • Posts: 2
Mounting ntfs usb drives during boot using ntfs-3g
« on: April 01, 2010, 10:24:09 AM »
Hi there

I am running 2.9 installed to hard drive (sda1). I am trying to build it up to replace XP and its going pretty well really - I have Xorg, Nvidia, Firefox, sound, VLC, Roxy, Cups, Epdf, Openoffice etc all working great.

I would like to mount a usb drive during boot. I have ntfs-3g installed.

The following command  works after boot if I type it in manually:

sudo /tmp/tcloop/ntfs-3g/usr/local/bin/ntfs-3g /dev/sdb1 /mnt/sdb1

so, I put it in /opt/bootlocal.sh (without sudo as I think this runs as root anyway), did a reboot with backup. And it doesn't mount the drive.

Is there a way to achieve this either in bootlocal.sh or another way?

Many thanks





Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: Mounting ntfs usb drives during boot using ntfs-3g
« Reply #1 on: April 01, 2010, 04:14:20 PM »
Put that statement in ~/.xsession?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Mounting ntfs usb drives during boot using ntfs-3g
« Reply #2 on: April 01, 2010, 07:46:46 PM »
A few points that come to mind:

(1) My hunch is that this is a timing issue. The USB drive is not (yet) recognized by the time '/opt/bootlocal.sh' is attempting to execute the mount. Suggestion: (a) put a sleep 5 before the mount command (you might have to adjust the delay timer to a higher value), or (b) take a cue from what SvOlli is suggesting in http://forum.tinycorelinux.net/index.php?topic=5584 and delay the mount until the device has been found.

(2) I'm pretty certain that '/opt/bootlocal.sh' is the "correct" place to insert a system-wide amendment. Whilst '~/.xsession' might work (since it gets executed later) that would be the place for user-specific startup stuff (post GUI). "Horses for courses" comes to mind ...

(3) Using the (absolute) path '/tmp/tcloop/ntfs-3g/usr/local/bin/ntfs-3g' does not "look right". If one wants to use an absolute path then '/usr/local/bin/ntfs-3g' would be it. But I doubt that '/usr/local/bin' is not in $PATH when '/opt/bootlocal.sh' gets executed. So just ntfs-3g /dev/sdb1 /mnt/sdb1 should do the trick.

Offline papillon

  • Newbie
  • *
  • Posts: 2
Re: Mounting ntfs usb drives during boot using ntfs-3g
« Reply #3 on: April 01, 2010, 11:41:15 PM »
Thank you for your reply.

1 (a) - this works, so I tried reducing the value to sleep 1 and it still works
1 (b) - haven't tried this method yet but it sounds like it works if its going into 2.11 build
2 - I did vaguely wonder if I could put the command in .xsession but I couldn't actually find it (doh) so didn't even try
3 Whilst I was experimenting I thought that maybe the path wouldn't be there when bootlocal.sh exectued, but I've now changed the command to 'ntfs-3g /dev/sdb1 /mnt/sdb1' and it is working as you say

Once again, many thanks for the very clear answer.

Regards

Pat