LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How to run apps as services and FSTAB questions (https://www.linuxquestions.org/questions/ubuntu-63/how-to-run-apps-as-services-and-fstab-questions-4175423413/)

alek66 08-22-2012 08:14 AM

How to run apps as services and FSTAB questions
 
I installed Lubuntu (a lightweight variant of ubuntu) on my new homerserver:

Services:
I would like to get vino(remote desktop server), transmission, and ps3media server to run as services (basically so I can monitor them via Ajenti (where I can see if the services are running, and stop/start/restart them))

Also to get the to start at boot time. I googled it, but could find a specific way to achieve this.

FSTAB:
I have 3 (hard, non remomable) disks on the BOX:
-Mounted File Systems-
/dev/sda1 / 32.59 % (73.9 GiB of 109.6 GiB)
/dev/sdc1 /media/TimeMachine 60.94 % (29.1 GiB of 74.4 GiB)
/dev/sdb1 /media/160 6.56 % (139.1 GiB of 148.8 GiB)

SDA1 is the disk where the OS is installed.
The other two, one is for time machine, the other as a general use. This two, are only mounted if I click on them on the GUI, I saw also they are not on the fstab:

Quote:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=5e94c099-d34f-45fc-b9dc-6f859dabc626 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=7f602713-1a85-4599-9767-c645ed77e978 none swap sw 0 0
I want those two disk to be mounted at boot time, automatically, Why don't they appear in the fstab? and appear as a "click n mount" drive?

Both other disk are ext4 and where at the installation.

camorri 08-22-2012 09:26 AM

Quote:

I want those two disk to be mounted at boot time, automatically, Why don't they appear in the fstab?
Were those drives in the machine when you installed? If not, you have to manually add them. That is normal operation.

If there were there, I have no idea why they were not picked up by the install. Add them now. You cnd find the uuid's for each partition in /dev/disk/by-uuid/ . Hope this helps.

alek66 08-22-2012 09:28 AM

Quote:

Originally Posted by camorri (Post 4761117)
Were those drives in the machine when you installed? If not, you have to manually add them. That is normal operation.

If there were there, I have no idea why they were not picked up by the install. Add them now. You cnd find the uuid's for each partition in /dev/disk/by-uuid/ . Hope this helps.

Cliff; thanks, yes, noth disk were at installation. Once I get the uuids what do I do, I dont want to mess up anything, If I add them to the fstab, will they still appear as "click n mount" drives?
I wont get duplicated entries?
thanks

camorri 08-22-2012 10:50 AM

The very first thing you do is make a backup copy of fstab. You need to be root to do so, on buntu's you prefix the commands with 'sudo command' and you will be asked for the root password. You enter the password and the system will execute the command.

To make a backup copy of fstab, the command 'sudo cp /etc/fstab /etc/fstab.back' will do it. Enter everything except the quotes, just what is between them. I'll show you quotes, so you do not add extra stuff to the commands. This command will create a new file called fstab.back in the /etc directory.

Next, look up the uuid's. I like the copy and paste them to avoid typos. If you make a typo error, the partition will not mount.

The easy way is to use a plain text editor for this task. All distros ship with vi, however for anyone with little experience, this is a challenge. See if you have nano or pico. In a konsole, try 'sudo nano /etc/fstab'. If the file opens, you are good to go. If not, ( you get a command not found ) substitute pico in place of nano. gedit is another one that might be there. Once you have the file opened with sudo; then you can add a line for each partition you want mounted.

From what you posted above, you have one line that looks like this:

Quote:

UUID=5e94c099-d34f-45fc-b9dc-6f859dabc626 / ext4 errors=remount-ro 0 1
Copy this line, and paste it below the last line of the file. Now edit the uuid field to match the first uuid ( partition ) you need to mount. The ext4 is the file system type. I would guess you formatted the drives as ext4. If not, then change this field to match the FS type. The rest, you can leave as is. This will give you system defaults, with "on errors" ( disk errors ) mount read only. They will mount read write on system default.

Once you have added a line for each partition, then it is time to test. As root user, issue a mount command. 'sudo mount'. The system will mount ad partitions not mounted. Use a file manager to see if you can see the partitions. If yes, you are good. Boot the system, and verify that all partitions are mounted.

If something doesn't mount check what you have done. Spacing matters, so look at what was there before you messed with the file, look for typing errors, or uuid errors.

alek66 08-22-2012 11:00 AM

Quote:

Originally Posted by camorri (Post 4761202)
The very first thing you do is make a backup copy of fstab. You need to be root to do so, on buntu's you prefix the commands with 'sudo command' and you will be asked for the root password. You enter the password and the system will execute the command.

To make a backup copy of fstab, the command 'sudo cp /etc/fstab /etc/fstab.back' will do it. Enter everything except the quotes, just what is between them. I'll show you quotes, so you do not add extra stuff to the commands. This command will create a new file called fstab.back in the /etc directory.

Next, look up the uuid's. I like the copy and paste them to avoid typos. If you make a typo error, the partition will not mount.

The easy way is to use a plain text editor for this task. All distros ship with vi, however for anyone with little experience, this is a challenge. See if you have nano or pico. In a konsole, try 'sudo nano /etc/fstab'. If the file opens, you are good to go. If not, ( you get a command not found ) substitute pico in place of nano. gedit is another one that might be there. Once you have the file opened with sudo; then you can add a line for each partition you want mounted.

From what you posted above, you have one line that looks like this:



Copy this line, and paste it below the last line of the file. Now edit the uuid field to match the first uuid ( partition ) you need to mount. The ext4 is the file system type. I would guess you formatted the drives as ext4. If not, then change this field to match the FS type. The rest, you can leave as is. This will give you system defaults, with "on errors" ( disk errors ) mount read only. They will mount read write on system default.

Once you have added a line for each partition, then it is time to test. As root user, issue a mount command. 'sudo mount'. The system will mount ad partitions not mounted. Use a file manager to see if you can see the partitions. If yes, you are good. Boot the system, and verify that all partitions are mounted.

If something doesn't mount check what you have done. Spacing matters, so look at what was there before you messed with the file, look for typing errors, or uuid errors.

Cliff: Thanks for all this instructions. I knew how to edit, and that I needed to be root. But it never hurts to repeat. I undertood everything perfectly, I just need to know one thing that might be basic....

Wheres the mount point for those new disks?

414N 08-22-2012 11:06 AM

Quote:

Originally Posted by camorri (Post 4761202)
Copy this line, and paste it below the last line of the file. Now edit the uuid field to match the first uuid ( partition ) you need to mount. The ext4 is the file system type. I would guess you formatted the drives as ext4. If not, then change this field to match the FS type. The rest, you can leave as is. This will give you system defaults, with "on errors" ( disk errors ) mount read only. They will mount read write on system default.

You forgot to mention that the mount point ("/" in your example) needs to be changed too.
If the directory you want to specify as mount point doesn't exist, simply create one with mkdir.

alek66 08-22-2012 11:09 AM

Quote:

Originally Posted by 414N (Post 4761226)
You forgot to mention that the mount point ("/" in your example) needs to be changed too.
If the directory you want to specify as mount point doesn't exist, simply create one with mkdir.

thanks man!!! will try it in a few hours, let ya know in a while.

camorri 08-22-2012 11:09 AM

Quote:

Wheres the mount point for those new disks?
Where ever you want.

As a suggestion, I create a empty directory in /mnt such as /mnt/sdb1 and mount sdb1 there. It makes it easy for me to remember.

Things to consider, is this system used by other users? If not, mount them where you want. You can mount them inside your home directory if you want. I wouldn't do that if you have other users accessing the drives though.


All times are GMT -5. The time now is 06:04 AM.