Set XBMC to Automount Drives

Whenever I install XBMC, one of the first settings I change is I enable auto mounting of drives. It’s a relatively simple change, but requires you modify a file on the filesystem.

For Ubuntu Lucid 10.04:

I’ve noticed that it’s not necessary to manually remove the nodiskmount option on 10.04 (grub2). The modifications that I used to make in /boot/grub/menu.lst on Ubuntu Karmic, I now have to make in /etc/default/grub on Ubuntu Lucid.. When I removed the nodiskmount on Ubuntu Lucid I started having some issues with the disks being mounted in odd ways (eg. my NTFS drive being mounted directly to /media). What I found is that instead of removing nodiskmount, if I just properly labeled my partitions, they would automatically show up properly — you can label your partitions using the e2label command.

As I noted in the comments below, you may still need to remove nodiskmount in Ubuntu Lucid to get your eSATA drive to mount (especially true for people who followed my Revo 1600 guide). What I found is that because the internal drive on the Revo 1600 is NTFS, it will cause the weird issues I mentioned above. If you happen to fall into this case, I would highly recommend you check out my article on Drives Being Mounted with Odd IDs. The article explains how to find the unique identifier (UUID) for your drive and manually create an FSTAB entry to mount your drive with your specifications each time the system loads. Now that I’ve wrapped my head around how FSTAB works, I prefer to use this method as it lets me set my own unique name, path, and other settings for how the drive is mounted.

However, if you’d still like to modify the grub parameters for other reasons, I’ve included the details below…

Open the file /etc/default/grub:

sudo nano /etc/default/grub

Find the line for loading your system (usually starts with GRUB_CMDLINE_LINUXDEFAULT) and make sure it’s not the commented out line that often comes default at the top of the file. Modify this line so it no longer has the nodiskmount option in it.

Save the file and close it. Ctrl+O, Enter, Ctrl+X.

Run the following line to update grub and then reboot:

sudo update-grub sudo reboot

For Ubuntu Karmic:

If you are still booting from the XBMC-Live 9.11 Camelot USB stick directly, this will be in the syslinux.cfg file. If you have installed XBMC to disk, this is in the /boot/grub/menu.lst file. 

To remove this flag from the menu.lst file, telnet into the XBMC machine (use the instructions from the sabnzbd install post if you don’t know how), then open up the file with your favorite editor:

sudo nano /boot/grub/menu.lst (you may have to enter your root username and password — typically xbmc / xbmc)

Arrow down to the first line under “## ## End Default Options ##” near the bottom of the file and on the “kernel” line arrow to the right until you see the “nodiskmount” text. Delete this text then press Ctrl+O [enter] to save the file then Ctrl+X to exit. Reboot your box and you should now see some new items in your file manager usually named something like sdb1 or sda1.


Posted

in

by

Comments

10 responses to “Set XBMC to Automount Drives”

  1. NotShorty Avatar

    Hi!

    Stumbled across your blog and I was hoping you may have some advice with the following problem since I can’t find a solution elsewhere.

    I’m unable to automount more than 1 internal hard drive with the latest build of XBMCFreak Live 10.08 (worked fine on all previous builds).

    Removed nodiskmount anywhere it appeared in ootgrubgrub.cfg and syslinux.cfg

    Mounts my IDE drive fine, but my 2 SATA drives aren’t being mounted. Am I missing something?

    If I go to “System info – Storage information” I can see
    /media 931.5 GiB (1TB SATA)
    /media 0.1 GiB (system reserved space?)
    /media 298.0 GiB (320GB SATA)
    /media 232.9 GiB (250GB IDE)
    /live/image 3.5 GiB (4GB USB, used for XBMCFreak boot disk)

    But as you can see, all the HDDs appear to be mapped to the /media directory (unlike /media/sda, /media/sdb, etc. in previous builds), and if I navigate to that directory from the file browser, I can only view the contents of the IDE drive.

    Thanks in advance for any help!

  2. josh Avatar
    josh

    @NotShorty-
    I found that removing the nodiskmount flag in 10.04 actually gave me more trouble. I was seeing similar results that you are seeing and found that my drives were actually showing up within the /media directory using their UUIDs (long alphanumeric identifiers). Check within the /media drive to see if you see your drives mounted as the UUIDs.

    I found that the only reason I would want the nodiskmount flag removed in my 10.04 setup is if I wanted me eSATA drive to be automounted… which I probably would have done via fstab now that I’ve seen how it works. I just got a 3 TB Seagate USB drive and I’ve found that it is automatically mounted if I leave the nodiskmount flag in.

    Ultimately, I ended up using FSTAB to have my USB drive automatically mounted with the name I wanted and the permissions I wanted. I wrote a post about using FSTAB and there is a comment at the bottom which shows how I mounted my NTFS formatted USB drive with permissions for all users (so Apache could access it as well).

    My Post on Using Fstab ([url]http://boshdirect.com/blogs/tech/xbmc-live-drives-mounted-as-odd-ids.html[/url])

    In your case, you would follow the fstab instructions, but add multiple lines for your multiple drives.

  3. XDoKToR Avatar
    XDoKToR

    Hey Josh,

    really appreciate the the help you have posted re: XBMC on Linux

    This post enabled me to finally get my Windows 7 NTFS Partion used for ‘storage only’ now accessable in XBMC on Lucid 10.08 Ubuntu

    older posts have guides to edit menu.lst which i did not seem to find?

    I edited the /etc/default/grub file as you instructed and worked a dream!

    cheers mate

    Andrew

  4. Anton Avatar
    Anton

    Surfing across I’ve found your post. I hope you’ll be so kind and help with the opposite case. The thing is that I want to disable automount since I’ve every thing mounted with fstab, but XBMC constantly mount my external drive and add it as a video source. I have my sources set up, but the drive appears on top of the list and makes me nerves 🙂
    How can I get rid of that?
    Thank you in advance.

    I’ve got 10.04 and latest XBMC from svn

  5. josh Avatar
    josh

    @Anton-
    I have my XBMC setup similar to the way you described. All drives are configured via Fstab (manually) and I didn’t want things to automount. All you should have to do is follow the instructions above for Ubuntu Lucid and instead of removing the ‘nodiskmount’ flag, you’ll want to make sure it is present in your configuration. Here’s what my GRUB_CMDLINE_LINUX_DEFAULT looks like:

    [code]GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash xbmc=autostart,nodiskmount,setvolume loglevel=0 video=vesafb”
    [/code]

    PS. As noted in the article, there are usually two GRUB_CMDLINE_LINUX_DEFAULT lines in the configuration file, but one of them is commented out (line starts with #). Make sure you are editing the line that is [b]not[/b] commented out.

  6. Anton Avatar
    Anton

    Yep. I’ve got “nodiskmount” and the disk has a label. However it still appears to be auto-sourced by xbmc

  7. greg nash Avatar
    greg nash

    when i reboot my machine, i seem to get the old splash screen with the spinning gear, then about 20 secs later i get the new brushed metal looking xbmc splash. i though maybe i was running it twice, but didn’t really know. when i read this post to try to get my 2 drives to auto mount, the bottom of my /bot/grub/menu.lst file looks like this:

    ## ## End Default Options ##

    title Ubuntu 9.10 – XBMCLive Dharma, kernel 2.6.31-16-generic
    uuid c0835e22-1c41-4d2d-a44a-5fdf11777ebe
    kernel /boot/vmlinuz-2.6.31-16-generic root=UUID=c0835e22-1c41-4d2d-a44a-5fdf11777ebe ro xbmc=autostart,setvolume loglevel=0 quiet splash
    initrd /boot/initrd.img-2.6.31-16-generic
    quiet

    title Ubuntu 9.10 – XBMCLive Dharma, kernel 2.6.31-16-generic (recovery mode)
    uuid c0835e22-1c41-4d2d-a44a-5fdf11777ebe
    kernel /boot/vmlinuz-2.6.31-16-generic root=UUID=c0835e22-1c41-4d2d-a44a-5fdf11777ebe ro xbmc=autostart,setvolume loglevel=0 single
    initrd /boot/initrd.img-2.6.31-16-generic

    ### END DEBIAN AUTOMAGIC KERNELS LIST

    is that why it appears to boot twice? or is my machine in recovery mode? i’ve no idea!

  8. josh Avatar
    josh

    Greg-
    Having two entries in your menu.lst is normal. This file is what generates the list of operating systems you can boot into when you first boot into Linux (GRUB). Each entry will also specify different flags to tell the operating system if there are any special things we want it to do. The key change related to getting your disks to automount is related to the [b]”nodiskmount”[/b] flag being present or not in your configuration.

    PS. The major difference between the two entries you listed is that one boots the operating system in a normal mode, which shows a pretty splash screen and hides all the messages. Whereas the second one shows all the things the computer is doing when it boots up (recovery mode) and boots you into “Single User” mode for recovery purposes.

  9. greg Avatar
    greg

    cheers for clearing that up

  10. Jason Avatar
    Jason

    Hi Josh.

    I upgraded xbmc 9.11 to 10 today, but my USB drives no longer auto-mount. Previously (in 9.11) my 3 USB drives mounted automatically as “MOVIES 3”, “MOVIES 4”, and “MOVIES 5” (with spaces) – which were the volume names on the FAT32 formatted drives. So my predicament is that I have a library of over 7000+ movies (and tv shows) that expect to find the files in the above mentioned mount points, but it seems that it’s not possible to create mount point names in /etc/fstab that contain spaces.

    I want to try and mount them with the same name the drives used previously, because I want to avoid re-scraping 7000+ files.

    Is it possible have spaces in mount names? Can you think of a workaround? Thanks in advance.

    Great xbmc info BTW. I fixed my missing NVidea driver problem using one of your other posts. Legend!

    Jason

Leave a Reply

Your email address will not be published. Required fields are marked *