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.

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?

share|improve this question
    
I will give that a shot and report back. –  user194862 Oct 20 '13 at 0:04
    
I looked at a lot of answers, but I still didn't find the way I did it which is by adding a new entry to Startup Applications which you can get to by clicking on the gear icon in the upper right-hand corner of the Ubuntu desktop next to the clock. I created a new Automount entry in Startup Applications using a custom terminal command. –  karel Oct 20 '13 at 0:08
    
If you know an answer post it. ;) –  user194862 Oct 20 '13 at 0:12
    
I looked at that solution with the pysdm. But I installed it and I just does not launch –  user194862 Oct 20 '13 at 0:55
    
I just use whatever comes with the default Ubuntu installation. I posted my answer as you requested. –  karel Oct 20 '13 at 1:47

4 Answers 4

up vote 4 down vote accepted

you can use Pysdm you can then set the drive to automatically mount from there. After installation it will be found under System>>Administration>>Storage Device Manager

share|improve this answer

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

  2. Open the Startup Applications window which you can get to by clicking on the gear icon in the upper right-hand corner of the Ubuntu desktop next to the clock, and selecting Startup Applications from the dropdown menu.

    enter image description here

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

  4. In the Name: field type in any name for the partition that you want to automount. In the Comment: field you can optionally type a descriptive comment about the partition that you want to automount.

    enter image description here

  5. 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

  6. 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

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.

share|improve this answer
    
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. –  user194862 Oct 20 '13 at 1:13
    
Another thing. Is there any performance drop for using this method? –  user194862 Oct 20 '13 at 1:17
1  
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 1:21
1  
2. 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 1:27
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 2:40
  1. Install Storage Device Manager:

    sudo apt-get install pysdm

  2. Select the drive you want to auto mount

  3. In the General Configuration tab > select Assistant
  4. In the Mounting Options tab check the "The file system is mounted at boot time" option
  5. Ok
  6. Apply
  7. Restart

--- edit ---

As far as I remember the Storage Device Manager doesn't use the UUID of the drive when adding it to the /etc/fstab file, which by default ubuntu now uses. You can update this yourself after the SDM sets up the drive if you like:

To find the UUID of the drive run:

blkid

And then modify the fstab, substituting in the UUID for the value the SDM used:

sudo vi /etc/fstab
share|improve this answer

You can use the following steps:

  1. Find the UUID of the drive you want to automount with this command:

    sudo blkid
    
  2. Copy the UUID="" field. Only copy the numbers, letters and hyphens inside the quotes, not anything else.
    An example would be the following, with numbers and letters instead of the x's and y's:

    yxxxxyyy-xxxy-yyyx-yyxx-yyyyyyyyyyxy
    
  3. Add this command to your Startup Applications, replacing <UUID_OF_YOUR_DISK> with the copied text from step 2:

    /usr/bin/udisksctl mount -b /dev/disk/by-uuid/<UUID_OF_YOUR_DISK>
    
  4. The disk will now be automounted on startup to

    /media/$USER/$DISK_NAME
    

    Where $USER is your username and $DISK_NAME is the disk label if it is set, otherwise it is the disk UUID.

References:

share|improve this answer

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.