Ubuntu – Auto-mount a Volume Group on Startup

mount

I have two physical volumes ( /dev/sda3 and /dev/sdb1 ) connected to one volume group (fileserver). When I boot up my computer and open up the file explorer, on the left, I see a Devices pane that says my volume group. However, I cannot connect to this server from any client until I click it. Clicking the volume group mounts it because it shows the eject arrow sign right next to it. As soon as I click it, then I am able to connect to the server and see my files.

My question is: how do I automate this process every time Ubuntu starts? I tried going to the Startup Applications and using this command

    mount /dev/mapper/fileserver-media /media/bfbe53bd-3306-401b-a8df-4363564cf1fc

but it didn't seem to do anything. I attached a picture to show what I mean.

This is what it looks like when I turn on my computer. http://i1285.photobucket.com/albums/a582/sameetandpotatoes/Before_zpsa67a3e4f.png

Now, this is what it looks like when I click on the device: http://i1285.photobucket.com/albums/a582/sameetandpotatoes/2_zps5c91a322.png

Here are the Terminal outputs of pvscan, vgscan, etc.

sameet@sapraserver:~$ sudo pvscan

PV /dev/sda3 VG fileserver lvm2 [216.07 GiB / 18.89 GiB free]

PV /dev/sdb1 VG fileserver lvm2 [232.83 GiB / 0 free]
Total: 2 [448.89 GiB] / in use: 2 [448.89 GiB] / in no VG: 0 [0 ]

sameet@sapraserver:~$ sudo vgscan

Reading all physical volumes. This may take a while…

Found volume group "fileserver" using metadata type lvm2

sameet@sapraserver:~$ sudo lvdisplay

— Logical volume —

LV Name /dev/fileserver/media

VG Name fileserver

LV UUID lrY16C-bNwH-fFvA-aVDW-Gtx6-2vIG-urrGpD

LV Write Access read/write

LV Status available

# open 2

LV Size 430.00 GiB

Current LE 110080

Segments 2

Allocation inherit

Read ahead sectors auto

currently set to 256

Block device 252:0

Thanks in advance for your help.

Best Answer

Okay, I figured it out finally. Here's what I did:

  1. First, I made sure I had the right Logical Volume name by running lvdisplay in terminal.
  2. Then, I had to edit the rc.local file in /etc/rc.local. I added the command there because I couldn't run a command as root in the Startup Applications (I would have to enter a password). In this file, for my system I added the following command:

    mount /dev/fileserver-media /media/
    

    The /dev/fileserver-media is the name of the logical volume (found with lvdisplay). The /media/ represents where I want the logical volume to be mounted.

  3. And then with Samba, I ran gksudo nautilus in the terminal, edited permissions, and shared it. The reason I ran this command in the terminal is to open up the file manager as root so I can be the "owner". I would not have been able to edit permissions without running this command.