arduino Raspberry Pi project

Raspberry Pi Setup FSTAB, Symbolic Links, Screen Shots

by Lewis Loflin

First we add user pi to various groups to access sudo, USB, audio, etc. if you haven't already:

$ su (give your root password when asked)
$ adduser pi root
$ adduser pi sudo
$ adduser pi audio
$ adduser pi dialout
$ adduser pi video
$ adduser pi games
$ adduser pi netdev
$ adduser pi users

Let's assume the user is pi. Open this folder and add the following as root:

$ leafpad /etc/sudoers

You should see something like this - add what isn't there:

# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# add this below
pi ALL=(ALL) NOPASSWD: ALL

Save and close leafpad. This gives user pi root access without having to type in a password with sudo every time. Type reboot (enter) to reboot RPi, log back in. Open a terminal, then type "sudo su" and you should be logged in as root if everything worked.

FSTAB

The /etc/fstab file can be used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem.

Each file system is described in a separate line. These definitions will be converted into system mount units dynamically at boot, and when the configuration of the system manager is reloaded.

The mount command will use fstab, if just one of either directory or device is given, to fill in the value for the other parameter. When doing so, mount options which are listed in fstab will also be used.

In this project I keep a thumb drive connected to store my programs and this will demonstrate how to setup fstab and how to create symbolic links.

See fstab wiki and Symbolic Links.

Setup RPi for using the thumb drive which is recognized as sda1. Type the following in sequence in a terminal and using whatever text editor (in this example Leafpad):

$ sudo mkdir /mnt/sda1
$ sudo leafpad /etc/fsab

Type (or cut and paste) the following at the end:

tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0

tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0

tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0

tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0

/dev/sda1	/mnt/sda1	auto	ddefaults 0	2

Make sure to press ENTER at the end!

The first four lines use RAM memory to save wear on your SD card due to a large number of writes.

Save and exit text editor. What we did was define the folder sda1 as linking to the thumb drive with fstab. This won't take effect until you reboot the system. Type reboot, come back log in as pi. Return to your home directory and open a terminal:

$ ln -s /mnt/sda1

From the file manager (Thunar, PCmanFM, or Rox-Filer) click on sda1 and one will be in the thumb drive.

Or from the command line or terminal type ls you should see sda1. Type cd sda1 (enter) and you will be in the thumb drive!

Fstab controls how Linux allows users to access disk drives and other devices. In this case we told RPi to auto mount the thumb drive, let users execute files, save file to the drive. It would be a good idea to go on the web and research fstab.

Scrot and Screen Shots


Scrot is a minimalistic command line screen capturing application. This is used in this project to take the screen shots in the list below. Scrot enables taking screenshots from the CLI and offers features such as a user-definable time delay. Unless instructed otherwise, it saves the file in the current working directory.

$ scrot -t 20 -d 5

The above command saves a dated .png file, along with a thumbnail (20% of original), for Web posting. It provides a 5 second delay before capturing in this instance. You can also use standard date and time formatting when saving to a file. e.g.,

$ scrot ~/Pictures/%Y-%m-%d-%T-screenshot.png -t 20 -d 5

The above saves the screenshot in a filename with the current year, month, date, hours, minutes, and seconds to a folder in your home directory called "Pictures" after a delay of 5 seconds. Make sure the directory is actually there!




Loading

Linux Videos

Live Linux Distro for Using Printer Port with Electronics
Using the powerful Rox-Filer system in Linux
Use FEH under Linux for a Wallpaper Setter
How to create Symbolic links in Linux

 


donate