Malith's Perspective

Wednesday, August 10, 2016

Conquering Raspberry Pi with Ubuntu 14.04 : Resolving issues with Partitioning

Posted by Unknown at 10:16:00 AM Labels: #Pi , #raspberryPi , #Ubuntu
Recently for a project, I used a Raspberry Pi. Although mostly it's preferred to use raspbian as an operating system, I chose to use Ubuntu because it gives access to the Ubuntu repositories as well. There is a complete guide for the installation here. However after sometime, I found that the Raspberry is utilizing only 2GB from its SD card which had the capacity of 8GB. This was quite a surprise because I formatted the SD card before installing Ubuntu on it.

I searched for a good resource to resolve this and I came across this wiki on elinux.org (http://elinux.org/RPi_Resize_Flash_Partitions).  However based on their instructions using raspi-config was not an option because I was running Ubuntu 14.04.

The other option which actually worked for me was to manually resize the SD card on linux.

Before you proceed with anything, I highly suggest that you take a copy of your SD card using HDD Raw Copy Tool.

First to show partition information I used the following command.  
$ df -h

Look for a partition which approximately has 2GB size of the distribution image.
$ umount /dev/mmcblk0p1

Then use parted to examine the card
$ sudo parted /dev/sdd
(parted) unit chs
(parted) print
Disk /dev/sdd: 121535,3,31
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 121536,4,32.  Each cylinder is 65.5kB.
Partition Table: msdos

Number  Start      End         Type     File system     Flags
 1      16,0,0     1215,3,31   primary  fat32           lba
 2      1232,0,0   26671,3,31  primary  ext4
 3      26688,0,0  29743,3,31  primary  linux-swap(v1)


Notice that nothing uses the card from the end of the cylinder 29743 to 121535 (which is the maximum). However in my case there wasn't a third partition called the swap. There were only two partitions; namely the boot partition and the root partition. I left the boot partition alone. I wanted to fill the SD card with the root partition. Nevertheless if there was a swap, then it would have to be moved to the end of the card. (You'll have to adjust the numbers so that the end of the partition 3 is at the end cylinder/head/sector of the card)

Here's the calculation.
Maximum - (Partition 3 End - Partition 3 Start) ) - 1 = Partition 3 New Start

So, in this example:
(121535 - ( 29743 - 26688)) -1 = 118479

Then move the partition. ( Note that this wouldn't work on parted versions later than 2.4 )
(parted) move 3 118479,0,0


However if there was no swap like in my case,  life becomes much simpler.

(parted) rm 2
(parted) mkpart primary 1232,0,0 121534,0,0
(parted) quit

Note that in my case, the head and sector numbers did not exactly coincide. (eg:- 3,31 at the end). Therefore as a precaution, I counted one cylinder less from the total available cylinders. ( i.e. 121534,0,0 )

The rest of the steps were easy.

Clean and resize the root partition.

$ sudo e2fsck -f /dev/mmcblk0p1

Allow it to add lost and found

$ sudo resize2fs /dev/mmcblk0p1

After the steps this was the result.



Tweet

No related post available

No comments :

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments ( Atom )

R-bloggers

  • Security blind spots in Shiny: why your app is more vulnerable than you think
  • Forwards To Offer R Package Development Workshops Online
  • Shiny in Production 2025: Workshops
  • maestro 0.6.0
  • Planning for a 3-arm cluster randomized trial with a nested intervention and a time-to-event outcome

Navigation

  • Home
  • Twitter

About Me

Unknown
View my complete profile

Blog Archive

  • 2017 (2)
    • May (2)
  • 2016 (4)
    • August (4)
      • Changepoint Detection : Theoretical Background
      • My Experience with GSOC and R
      • postCP change point detection with GSOC
      • Conquering Raspberry Pi with Ubuntu 14.04 : Resolv...
  • 2014 (2)
    • December (2)

Popular Posts

  • postCP change point detection with GSOC
    Introduction The project aimed at improving the postCP package and making it available on CRAN again. The snag that prevented the pac...
  • Using fabric8 docker-maven-plugin to automate docker builds
    In building the required libraries for a docker container, using a maven project, the libraries have to be copied to a separate location an...
  • My Experience with GSOC and R
    It all began when I started searching for a Google Summer of Code project last year (November, 2015) . While I was searching through the we...
  • Gauge Meters; A daunting task
    Since I'm on vacation, I thought of planning my project using the free time. As the next step, I thought of developing the front end of...
  • Changepoint Detection : Theoretical Background
    Introduction  Changepoints are abrupt variations in the generative parameters of sequential data. Changepoint detection is the process o...
  • Conquering Raspberry Pi with Ubuntu 14.04 : Resolving issues with Partitioning
    Recently for a project, I used a Raspberry Pi. Although mostly it's preferred to use raspbian as an operating system, I chose to use U...
  • Setting up Kubernetes 1.7 on a CentOS 7.1 cluster
    It was quite a daunting task at the beginning to start with Kubernetes 1.7 alpha release because I knew that I was bound to face with diffi...
  • Air Conditioning? Big Deal?
    Last week we were assigned projects for our 4th semester and I was selected for the energy sector. As a part of it, when I was exploring t...
Powered by Blogger.

Labels

#GSOC (3) #Tech (3) #postCP (3) #Kubernetes (2) #R-gsoc (2) #docker (2) #CentOS (1) #Cluster (1) #Pi (1) #R (1) #Ubuntu (1) #docker-maven-plugin (1) #fabric8 (1) #raspberryPi (1) Air Conditioning (1) Embedded (1) Micro Controllers (1) Power consumption (1) Smart Systems (1) Tech (1)

© Malith's Perspective 2016 . Powered by Bootstrap , Blogger templates and RWD Testing Tool