Warning, use these instructions on your own risk.

 

When I tried to resize the 16GB SD card in the raspberry pi version 2 I got a corrupted file system and all other kinds
of nastiness.

So I decided to try to resize the thing manually.

First “dd” the image to the SD card.

Leave the card in the reader/writer and issue the following comands, replace the device for you own device
and use the units for your card.

 

$ sudo parted /dev/sdd
 GNU Parted 2.3
 Using /dev/sdd
 Welcome to GNU Parted! Type 'help' to view a list of commands.

 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 16,1GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
Number Start End Size Type File system Flags
 1 4194kB 62,9MB 58,7MB primary fat16 lba
 2 62,9MB 3277MB 3214MB primary ext4

(parted) unit chs
 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 1955,244,16
 Sector size (logical/physical): 512B/512B
 BIOS cylinder,head,sector geometry: 1955,255,63. Each cylinder is 8225kB.
 Partition Table: msdos
Number Start End Type File system Flags
 1 0,130,2 7,165,29 primary fat16 lba
 2 7,165,30 398,97,18 primary ext4

(parted) rm 2
 (parted) mkpart primary 7,165,30 1955,244,16
 (parted) quit

 Information: You may need to update /etc/fstab.

$ sudo e2fsck -f /dev/sdd2
 e2fsck 1.42.9 (4-Feb-2014)
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 /dev/sdd2: 86233/196224 files (0.1% non-contiguous), 630146/784640 blocks

 $ sudo resize2fs /dev/sdd2
 resize2fs 1.42.9 (4-Feb-2014)
 Resizing the filesystem on /dev/sdd2 to 3912448 (4k) blocks.
 The filesystem on /dev/sdd2 is now 3912448 blocks long.

$ sudo parted /dev/sdd
 GNU Parted 2.3
 Using /dev/sdd
 Welcome to GNU Parted! Type 'help' to view a list of commands.
 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 16,1GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
Number Start End Size Type File system Flags
 1 4194kB 62,9MB 58,7MB primary fat16 lba
 2 62,9MB 16,1GB 16,0GB primary ext4
(parted) quit
 $

 

And of course, don’t choose ‘resize’ when the rspi first boots 🙂