Mainly adding in a 1-TB USB hard Disk Drive.

Updated to reflect using rsync

Please note, I am now using Pi-3B Plus and a Jump Drive with the 4TB as a Media file storage 20181201

First off I am an Amateur Radio Operator and enjoy working on Computers and have been since 1975. Long before Apple and Radio Shack. The old Machine code, Assembly code and then on to CP/M and CP/M. The on to IBM’s stuff and the scourge that is called Microsoft. Yes I do use Microsoft windows 7 x64 right now, but I really like the Raspberry Pi in the B and Pi 3 flavors. BTW: There may be a slight change from a Pi 2 to a Pi 3 as I had changed Pi’s during build. All this works well on a Pi 2 also.

Enough history and move onto Linux which was somewhat modeled from Unix, which I got nasty and dirty with in the mid 0’s and 80’s. This subject will be broken into several sections as I progressed through accomplishing what I wanted to do; which is to have a it running 24/7 and use less power than what I am using now. this computer uses about 200 watts per hour. My setup is approximately 1 Raspberry Pi 3, using less than 2 watts (1.23 watts) and a Hub which is using about 7 Watts. So now I have the Computing part down to less than 10 watts. Actually the 7 watts is a guesstimate and I’m sure it is less; I will measure it soon. I have a direct connection to my Router about 8 inches away, Keyboard and mouse (generic I/O from Big Lots). A case, another 7 bucks and a small fan $1.97 from China. I do have a great monitor I got from Amazon, that is a TV/HDMI (SuperSonic)works with A/C and 12 volts for emergency power. I have a SD Card writer on my Windows machine to put the downloaded code from the internet. I recently have been having problems with some SD Cards and noticed my reader/writer is not working quite right. Perhaps over use on a $10.00 item.

 Section 1.A:

Getting the code and putting it into the Raspberry Pi 3. Their are examples everywhere, so this is not a definitive ALL inclusive only way to do things. As your millage will vary. (Not talking about my Jetta TDI) Things you will need. Patience and lots of it as a simple keystroke and its start over time.

You will need a SD Card slot for formatting and reader/writer for your computer. Get one off eBay, so between $10.00 and $20.00 should get a fairly good one and plug it into your computer and check Windows Explorer (Not IE or Internet Explorer) and before you plug it in make note what Disks you may have; plug in the reader/writer and see if anything shows up after windows goes through its driver install. They are mostly generic so should not take long. After that you should see several NEW drives. Now plug in your SD card and see where it is at. Mine is on Removable Disk (S) so I may refer to it, but know yours most likely will not be the same disk.  You’ll get use to it so let us continue on.

Just got the Newer SDFormatter 4.0 from: Windows/MAC versions.

Win32DiskImager version 0.9.5 at

As always watch out for MalWare.

You will now need a image here are where some are available:


For my purposes I am using Ubuntu 15.10. the older versions of Ubuntu used a lot of memory and slowed down the system so much I needed a liter version and was using U. For what is is worth Ubuntu Mate 15.10 seems to do just as well as the Ubuntu’s folder version. I just clicked on the Ubuntu Mate Icon and it goes to where you need to be.

SD Cards can be a sore-spot, be sure to find Class 10 cards and research on the web as not all SD Cards aren’t the same and some won’t work. You can get some with the Distributions already loaded, but remember you will need backups so get one and see if you are able to format it and write the image on it then on to booting up the RPi2.

Section 1.B

To start we need to format the card. After you have installed the SDFormatter Version 4.0 run it now.  Now you will see you must have the Drive letter and make sure it is the correct drive letter. Again mine is S drive in the Drive letter, so yours probably will be different (Make sure it’s not C or perhaps D drive). Size detected isn’t too important at this point. You can put a “Volume Label” on it if you wish. Click on “Options” and set “Format Type” to FULL(Overwrite) and “FORMAT SIZE ADJUSTMENT” to ON. Click OK and we are ready to format. Please be sure you are NOT Formatting one of your Hard Disk Drives. Click on “Format” and the response from the computer is a window “Do not remove the drive during formatting. Are you sure you want to format?” Again be sure it isn’t one of your Hard Drives, you have been warned. Please get help if need be. If you are sure, then click “OK” and the system will start formatting. If your SD card is 16GB or larger go for a cup of coffee and watch a TV show or read a book. It takes quite a while and so does writing an Image. When the SDFormatter is complete, you will get another window showing it either completed or failed. If it failed, then you might recheck what you did or set that SD card aside for some other usages. You could always try to format it again.  Don’t worry too much as this will become second nature in things to do if you choose to start working with the Raspberry Pi. Once it is done, close the SDFormatter program

Section 1.C

Well this just seems to be a continuation from what we just did and takes about as long. You must have already downloaded your choice of System images. As before mine is Ubuntu 15.10 and I’ll go with that in my explanation. Now we execute the Win32 Disk Imager. On the right-hand side of the Win32 Disk Imager window you should see Device. If it hasn’t already found your Drive letter, use the menu pull-down and select the correct drive letter that you had in the SDFormatter program. Under the Image File to the right near the device and disk drive letter you should see a small folder. This folder is another  selector, so click on it and a pops up a Select a disk image just like most other programs, OK similar. You will then need to go to the drive and directory where you saved your image file. My image file was called ubuntu-mate-16.04-desktop-armhf-raspberry-pi-2.img, and you should remember you stored it somewhere. Select your Image file called ???????.img  For now er will be writing the image to your SD Card.  When you pause over Write it should say something like this “Write data in ‘Image File’ to ‘Device'” and click Write and then click on Yes button go get the rest of that pot of coffee, finish the movie on the DVR or a couple more chapters in your favorite book you were reading. If all goes well when you comeback later today or next week it should open a small window saying the write was successful. I hope so anyway, else put the card into some place you won’t get it confused with the cards that work. The following contains comments then the commands executed for adding in my 1TB Hard Disk Drive.

# Added in a Hard Drive 1TB.

# be sure to get current updates to your Operating System

sudo apt-get update
sudo apt-get upgrade




# Then reboot.


# make sure everything seems to work OK.

sudo fdisk -l
this should show your SD card only
plug in USB HD ,
sudo fdisk -l
this should show another HD probably at /dev/sda
sudo fdisk /dev/sda

# [delete all partitions on /dev/sda, repeat as necessary]; unless you know what was there # and if it was salvageable.

#  Now we start up with setting up new partitions, [new partitions create 3 , one that takes # up most of the disk and a small 2Gig one that will be used as swap [type 82]] Was 82 in

# Ubuntu 15.10, in 16.04 it changed to 19 for swap and 20 for Operating System and Data.

# default on start and +2GB for swap space
# default on start and +30GB for Operating System space
# I used 30GB as if I want to save this OS, it needs to fit on SD 32GB card

# for /dev/sda1
# type is 83 (16.04 20) should already be Linux, use L to list and check type

# was 83


# type is 83 should already be Linux, use L to list and check type

# was 83

# write all this or you wasted my time reading this.


# reboot three sync’s from old UNIX days
sudo sync
sudo sync
sudo sync
sudo reboot

# Continue from here after reboot# this creates an ext4 filesystem
sudo mkfs.ext4 /dev/sda1

# this creates an ext4 filesystem

sudo mkfs.ext4 /dev/sda2

# this copies the 2nd partition of your sd card to the 1st partition of your hard drive.

# Additional information here: I have had better luck using:

# rsync -axv / /mnt

# I have found ‘rsync’to be not only faster, but tends to make a more usable file system.

# instead of: sudo dd if=/dev/mmcblk0p2 of=/dev/sda1 bs=32M conv=noerror,sync

# so here is how I copy my file structure.

# First I mount the drive then I rsync File structure to it

sudo mount /dev/sda1 /mnt

sudo rsync -axv / /mnt

# this checks the file system. umount file system first.

sudo umount /dev/sda1
sudo e2fsck -f /dev/sda1

# this checks the file system
sudo e2fsck -f /dev/sda2

# this expands the data to fill the partition
sudo resize2fs /dev/sda1

# this expands the data to fill the partition
sudo resize2fs /dev/sda2

# now it gets a bit tricky
# [make a backup of the original cmdline.txt file]
sudo cp /boot/cmdline.txt /boot/cmdline.txt.original

sudo nano /boot/cmdline.txt

# or your editor of choice
change the /dev/mmcblk0p2       to be       /dev/sda1

# here is my old cmdline.txt file.
#dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4elevator=deadline rootwait quiet splash

# new ones may look similar to:
# dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline

# rootwait quiet splash
# you are changing the boot device from the SD card partition 2
# to the Hard disk partition 2

# you should also

sudo mount /dev/sda2 /mnt

# and change in

# the root device also [/dev/mmcblk0p2 /
# to be


sudo sync
sudo shutdown -r now

# add auto mount a directory on boot.

# edit fstab, This is similar to old /etc/fstab
# I want to mount my /dev/sda2 filesystem to mount on boot.

# old /etc/fstab:

proc                            /proc       proc       defaults                   0       0
/dev/mmcblk0p2   /                ext4       defaults,noatime  0       1
/dev/mmcblk0p1   /boot/       vfat       defaults                    0       2

# new fstab:

proc                            /proc          proc      defaults                     0     0
/dev/sda1                 /                    ext4      defaults,noatime    0      1
/dev/sda2                 /mnt            ext4       defaults,noatime   0      1
/dev/mmcblk0p1  /boot/          vfat        defaults                     0      2

# a special note here:I am using “ss” instead of “sw” for definition of swap space.

# I found that sw wasn’t getting reconised and somewhere I found a reference to ss.

# then three syncs… again from the old Unix days at Maw Bell.

sudo sync
sudo sync
sudo sync

sudo reboot or sudo shutdown -r now

# basically you are through after the boot and may arrange
# your system as you please and before for that matter.
******************* end of adding HDD ***********************

# After system boots mine looks something like this:

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 28G 8.8G 19G 32% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 292K 463M 1% /dev/shm
tmpfs 463M 7.6M 456M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 64M 20M 45M 32% /boot
tmpfs 93M 36K 93M 1% /run/user/1000
/dev/mmcblk0p2 15G 9.5G 5.1G 66% /media/w4qed/PI_ROOT
/dev/sda3 887G 4.4G 838G 1% /mnt

# you can see my +28GB translated to 28GB for root

# This is how I like my filesystem linked so modified and
# saved code goes to Hard Drive /dev/sda3.

mkdir /mnt/Documents
mkdir /mnt/ Downloads
mkdir /mnt/Hints
mkdir /mnt/insteon
mkdir /mnt/local
mkdir /mnt/ Music
mkdir /mnt/Pictures
mkdir /mnt/Public
mkdir /mnt/script
mkdir /mnt/Tools
mkdir /mnt/Videos

chown w4qed:w4qed /mnt/.
ln -s /mnt/Documents/ Documents
ln -s /mnt/Downloads/ Downloads
ln -s /mnt/Hints/ Hints
ln -s /mnt/insteon/ insteonus
ln -s /mnt/local/ local
ln -s /mnt/local/* /usr/local/.
ln -s /mnt/Music/ Music
ln -s /mnt/Pictures/ Pictures
ln -s /mnt/Public Public
ln -s /mnt/script/ script
ln -s /mnt/Tools/ Tools
ln -s /mnt/Videos/ Videos

# I was having trouble and the problem was I did not follow my own directions, I was taking shortcuts

# and they did not work. Cost me a few days. Duh!!!


The following is added in to help, but will not be discussed. Again if you have any

Questions about it, please just ask.


Now for YAAC, Yet Another APRS Client.


# download

wget “”


At this point I used /mnt/local/YAAC, but it would normally default ~/YAAC directory under the logged in user.

Watchdog Timer.

Re-allow sudo rights if they stop in pi

pkexec /usr/sbin/visudo


Add watchdog to rebook or shutdown

# verifies it is there.
echo “bcm2708_wdog” | sudo tee -a /etc/modules
sudo modprobe bcm2708_wdog
sudo cat /etc/modules

sudo apt-get install watchdog chkconfig -Y
sudo chkconfig watchdog on
sudo /etc/init.d/watchdog start

#get just incase
sudo apt-get install watchdog

sudo /etc/init.d/watchdog start

#make sure it runs on every boot
sudo update-rc.d watchdog defaults

sudo nano /etc/watchdog.conf

#make sure uncomment : #watchdog-device

#make sure uncomment #max-load-1 = 24
max-load-1 = 24

sudo chkconfig watchdog on
sudo systemctl start watchdog.service

Apache2 Web-Server


#set up apache
sudo apt-get install apache2 -y
sudo nano /etc/apache2/ports.conf

While rebuilding the system, I have not had a chance to see if the following will work as I had a Lightning Strike. I have verified the HDD install within the last 3 days of this article.


NameVirtualHosts *:8080
Listen 8080


DocumentRoot /var/www/

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/access.log combined

Setting up Samba


  I have verified this setup as of three days before this article’s release.

@ set up samba

sudo apt-get install samba

sudo workgroup =
wine spoourt – yes

wine support = yes

# add to smb.conf

comment= w4qed Home
only guest=no
create mask=0777
directory mask=0777
comment= w4qed Home
only guest=no
create mask=0777
directory mask=0777


Hey I actually used it in something; my professors would be sort of proud.

Quod Erat Demonstrandum