4/10/2016

PINE64: modify file system size to max of SD card

You will find the route directory /dev/mmcblk0p2 is 3.5GB even if you install Ubuntu into more than 4GB micro SD card. I am using 16GB micro SD card.
$ df -h | grep /dev/mmcblk0p2
/dev/mmcblk0p2  3.5G  690M  2.6G  21% /

The size can be changed to the max size of SD card using fdisk.
$ sudo fdisk /dev/mmcblk0
Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-31422463, default 2048): 143360
Last sector, +sectors or +size{K,M,G,T,P} (143360-31422463, default 31422463):

Created a new partition 2 of type 'Linux' and of size 14.9 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

After this, reboot PINE64:
$ sudo reboot


Once OS starts, you can resize the partition.
$ sudo resize2fs /dev/mmcblk0p2
[sudo] password for ubuntu:
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 3909888 (4k) blocks long.

You will see the size is changed.
$ df -h | grep /dev/mmcblk0p2
/dev/mmcblk0p2   15G  691M   14G   5% /

2 comments:

  1. Worth noting that you need to remove the previous Linux partition with fdisk (or cfdisk) as well before you start adding a new one.

    ReplyDelete
  2. Indeed - delete partition 2, then all worked great. Thanks.

    ReplyDelete