Search This Blog

Mounting a Drive With a Raspberry Pi



When you plug a USB hard drive or flash drive into a Raspberry Pi, you need to mount it to access the data on it. To do that, you need to know what name the OS has given the drive. So plug it in then run this command dmesg | tail. This will output something like this:

[ 1238.761341] sd 6:0:0:0: [sdb] 126058496 512-byte logical blocks: (64.5 GB/60.1 GiB)
[ 1238.762086] sd 6:0:0:0: [sdb] Write Protect is off
[ 1238.762091] sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1238.763149] sd 6:0:0:0: [sdb] No Caching mode page found
[ 1238.763155] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 1238.766839] sd 6:0:0:0: [sdb] No Caching mode page found
[ 1238.766846] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 1238.767747]  sdb: sdb1 sdb2


You can see that the OS has referred to the drive as sdb, with two partitions sdb1 and sdb2. To mount sdb1, you can make a directory to mount it to:

mkdir ~/mydrive

Then mount it:

sudo mount /dev/sdb1 ~/mydrive

Now your drive is mounted at that location and all the files will be within the mydrive folder. Depending on the filesystem of the partition, you might need to change the ownership to write to the drive:

sudo chown -R your_username:your_username ~/mydrive


 

Quickly Set Up Your Raspberry Pi With This Easy Script


If you're wanting to quickly set up your Raspberry Pi for web projects, check out this script from GitHub user Xeoncross: lowendscript. It was created for use with low-resource VPS servers and removes a lot of the default programs that Debian comes with that you likely do not need.

This script is great for people that are looking to do web development and other web projects on their Raspberry Pi, but want their Pi running as efficiently as possible. However if you'd like to do your set up manually, I've talked about a few web project set ups here:

Setting up Apache on a Raspberry Pi
Setting up Nginx on a Raspberry Pi
Router Settings Going to a Raspberry Pi
Nginx and PHP on a Raspberry Pi

Changing the user password on a Raspberry Pi

To change your password on a Raspberry Pi, use the passwd command:

robert@rpi $ passwd
Changing password for robert.
(current) UNIX password: 
Enter new UNIX password: 
Retype new UNIX password: 

passwd: password updated successfully

You will be asked for your current password, then to enter your new password twice to make sure you don't make a mistake.

Raspberry Pi News, Week of February 1 2015




Here is some additional Raspberry Pi action elsewhere on the internet, for those of you that can't get enough this week.

Raspberry Pi 2: 6x Faster than Original, Will Run Windows 10







Raspberry Pi 2
Raspberry Pi 2

The Raspberry Pi Foundation announced that the successor to the original Pi is now on sale. You can order the Raspberry Pi 2 right now for $35, the same price as the original Pi. Even though it doesn't cost more, the new Pi packs much more power and new features compared to the original, which came out in February of 2012. Now, three years later, the Pi Foundation has released a credit-card sized machine with 6 times the power of the original. It packs a 900 MHz quad-core ARM Cortex-A7 and 1GB of LPDDR2 SDRAM. That's twice the memory of the original Pi.

And since this is an ARMv7 processor (opposed to the previous ARMv6), it can run many more operating systems, including Windows 10. Microsoft has even announced that there will be a free version of Windows 10 for the Raspberry Pi 2. The founder of the Raspberry Pi Foundation even said "I think it's a usable PC now". I've been using my original for a while now :). Joking aside, he meant that you could even use the Pi as a general-purpose computer, whereas the past models were better of used for small programming experiments or headless utility machines.

If you're worried about your original Raspberry Pi becoming obsolete, you can rest assured. The Raspberry Pi Foundation has said that they will continue to produce Model A, Model B, and Model B+.

Here's a link to the store if you're looking to pick up one the new Pi's: Raspberry Pi 2.

Keeping your Raspberry Pi Up to Date

TL;DR: Run these two commands to keep your Pi up to date (for Debian/Raspbian derivatives):

sudo apt-get update
sudo apt-get dist-upgrade

Keeping the software on your Raspberry Pi updated to the current versions is very important. This will help protect your from security vulnerabilities and keep the Pi running better in general. It seems every week developers are finding security holes in well-known programs, some even revealing weaknesses that have been present for months or years. OSS (open source software) developers also strive to improve program efficiency and make things work better and faster with new versions. So it will benefit you to run the update commands shown above on a regular basis for your Raspberry Pi.

I run them every weekend as part of my data backup routine. After running them, you might want to reboot your Raspberry Pi, especially if you see that a new Linux kernel has been installed.