Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.
Showing posts with label Raspbian Jessie. Show all posts
Showing posts with label Raspbian Jessie. Show all posts

Sunday, January 17, 2016

Raspberry Pi - expanding root file system

I was playing with a Raspberry Pi 2 Model B for last couple of days. My OS installation notes are here, and after the OS I installed VNC, Samba and Apache HTTP Server. Once I finished these installations and configurations, I noticed the root file system was 98% full. I was using a 64 GB Micro SD card, but the root filesystem was created on a partition of 3.8 GB only. So I needed to expand the root file system.

I found the following tutorial quite useful, it has step-by-step instructions that worked great.
https://www.raspberrypi.org/forums/viewtopic.php?f=51&t=45265

However, the "mkpart" resulted in an error:
Error: The maximum head value is 254.

In order to fix it, I had to reduce the value. Initially I was trying:

(parted) mkpart primary 6,127,57  1946,255,62

that resulted in the error. Error: The maximum head value is 254.

Then I tried reduce the head value to 254:

(parted) mkpart primary 6,127,57  1946,254,62

but still no luck.

But the following finally worked:

(parted) mkpart primary 6,127,57  1945,252,62

Rest of the tutorial worked as-is for me.

Getting started with Raspberry Pi 2 Model B - OS installation and fixing display issue (no dosplay on HDMI TV)

Devices:

Raspberry Pi 2 Model B (I bought it with a case and charger - Amazon link)
64 GB Micro SD card that came with an adapter -  Amazon link
(I also used a different USB adapter - Amazon link) 
MacBook Pro early 2011 running OS X El Capitan 10.11.2
Samsung TV PN58C8000YF (any other TV with HDMI ports should work)
USB keyboard and mouse
Ethernet cable
HDMI cable

OS installation:

1. I downloaded the OS image from https://www.raspberrypi.org/downloads/raspbian/ - Raspbian Jessie and unzipped the image file.  Connected the Micro SD card using the USB adapter to my MBP, then ran diskutil to find the device.

2. ~ RitwikG$ diskutil list
/dev/disk0 (internal, physical):
  ...
/dev/disk1 (disk image):
  ...
/dev/disk2 (disk image):
   ...
/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.4 GB    disk3
   1:             Windows_FAT_32 UUI                     32.4 GB    disk3s1

So disk3 here is the Micro SD card. Then I unmounted the card and copied the data from the downloaded image file to the SD card.

3. ~ RitwikG$ diskutil unmountDisk /dev/disk3
Unmount of all volumes on disk3 was successful
4. ~ RitwikG$ sudo dd bs=1m if=2015-11-21-raspbian-jessie.img of=/dev/rdisk3

You can find more information about this at https://www.raspberrypi.org/documentation/installation/installing-images/mac.md.

Please note: The raw disk /dev/rdisk3 was used in the command above. If you use /dev/disk3 instead, it will work as well but will take a lot longer to finish the copy operation. You can find more details about it at http://superuser.com/questions/631592/why-is-dev-rdisk-about-20-times-faster-than-dev-disk-in-mac-os-x.

The next step is connecting the Raspberry Pi with the SD card, ethernet cable that's connected to the router, keyboard. mouse, HDMI cable connected to the TV and at last the power cable to turn it on. At this point I was disappointed to see  that there was NO display on my TV screen. So I powered off the RP, took out the SD card, connected it to my laptop and made the following changes.

5. Go to the SD card directory, find the /boot/config.txt file, then add/uncomment the following:

hdmi_force_hotplug=1
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=47

You can find more details about these changes here:
https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=5851
Also some useful commands:

Run “tvservice –m CEA” to give a list of CEA supported modes.
Run “tvservice –m DMT” to give a list of DMT supported modes.
Run “tvservice -s” to give you the current state.

After that I connected the SD card back to the RP, and powered it on. Voila! The display was on my TV screen and I was all set to start playing with the RP.