7

I have my musics in another partition of the HD, and I would like that, on login, the partition to be auto-mounted, so I can just open the media player and listen to my music. Is there a way?

The Student
  • 11,926

4 Answers4

7

The screenshot below shows the secondary ext4 partition that is going to be automounted at startup. This partition is mounted at /dev/sda4

enter image description here


How to automount an ext4 partition that is on a secondary hard drive

  1. Install udisks: sudo apt-get install udisks

    Update: In Ubuntu 16.04 and later install udisks2: sudo apt-get install udisks2

  2. Search for startup in the Dash and open the Startup Applications Preferences app.

  3. Click the Add button to add a new startup program.

    enter image description here

  4. In the Name: field type in any name for the partition that you want to automount.

  5. In the Comment: field you can optionally type a descriptive comment about the partition that you want to automount.

    enter image description here

  6. Open the terminal and run the command: sudo blkid to find the UUID of the partition you want to automount. The output will be a list of information about all the partitions including their UUIDs. Running the sudo blkid command will produce output similar to:

    /dev/sda1: TYPE="ntfs" UUID="72C0DE8EC0DE57C5" LABEL="windows" 
    /dev/sda2: UUID="30fcb748-ad1e-4228-af2f-951e8e7b56df" SEC_TYPE="ext2" TYPE="ext3" 
    /dev/sda5: TYPE="swap" UUID="8c4e69f8-5074-42c0-8134-0b2429c4c02c" 
    /dev/sdb1: SEC_TYPE="msdos" UUID="4848-E35A" TYPE="vfat" 
    

    In this example you want to automount the /dev/sda4 partition which is selected and highlighted in blue in the screenshot that is shown above. The UUID is the value of the first hyphenated hexadecimal string that appears after UUID= without including the two quotation mark characters. In the code block that is shown above, the UUID of /dev/sda2 is:
    30fcb748-ad1e-4228-af2f-951e8e7b56df

  7. Edit the Command: field so that it is similar to this: /usr/bin/udisks --mount /dev/disk/by-uuid/value-of-UUID-from-step-4

    Update: In Ubuntu 16.04 and later edit the Command: field so that it is similar to this: /usr/bin/udisksctl --mount /dev/disk/by-uuid/value-of-UUID-from-step-4

  8. Click the Save button in the Add Startup Program window. In later versions of Ubuntu there is an Add in the lower right corner of the Add Startup Program window instead of a Save button.

The next time you start your computer, the partition on your secondary hard drive will be automounted, and the drive icon for the partition on your secondary hard drive will appear in the Launcher.

karel
  • 114,770
  • I think in your answer it would be better if you changed "value-of-UUID-from-step-4" to the actual UUID from step 4. Besides that it looks promising, and I will try it tomorrow. –  Oct 20 '13 at 01:13
  • Another thing. Is there any performance drop for using this method? –  Oct 20 '13 at 01:17
  • 2
    I can't do that because the actual UUID that you get from running sudo blkid will be different for you than any of the values of the UUIDs from step 4. The values of the UUIDs will be different in different computers, so you just have to run sudo blkid and be careful to choose the UUID for the correct partition that you want to automount. – karel Oct 20 '13 at 01:21
  • 1
  • There is no detectable performance drop. When I boot my computer, the drive icon for the automounted partition appears along with all the other icons in the launcher as soon as I can see the desktop wallpaper.
  • – karel Oct 20 '13 at 01:27
  • Once it mounted the script goes away from RAM right? –  Oct 20 '13 at 01:28
  • I checked in my System Monitor. I didn't find any running processes for Startup Applications or mount or any CPU usage at all except for the System Monitor itself. Normally what happens is that the partition is automatically mounted at boot and unmounted at shutdown. If I logout, I can see that the partition is mounted when I login. I don't know the answer to your question about the RAM. – karel Oct 20 '13 at 01:43
  • I mean it does not continue to run. After the script executes properly it goes away. –  Oct 20 '13 at 01:59
  • 3
    @user320 It's not a script, it's a command. Just like any other command it itself won't use any RAM. – Seth Oct 20 '13 at 02:40