From XinCheJian
Jump to: navigation, search


Getting Started with cubieboard, the quick way


follow this guide:

Debian - resize the disk image

Assuming you are using Debian, i put a 16GB card in mine since it was 110rmb.. but the disk image is for a 2GB Disk

The Short Version:

    Backup your system
    Remove the main and swap partitionS (leaving the boot partition alone)
    Recreate the main partition to utilize the remaining disk space (excluding the boot partiton). Make sure to reuse the same start sector as the original root partition.
    reboot the system
    resize the new boot root partition to utilize the full partition size.

Step by Step Instructions

First make a backup of your SD Card using the instructions found here in case something goes wrong.

From the command line or a terminal window enter the following

sudo fdisk /dev/mmcblk0

then type p to list the partition table

you should see three partitions. if you look in the last column labeled System you should have

/dev/mmcblk0p1            2048      127071       62512    e  W95 FAT16 (LBA)
/dev/mmcblk0p2          131072     3451383     1660156   83  Linux

make a note of the start number for partiton 2, you will need this later. though it will likely still be on the screen (just in case).

next type d to delete a partition.

You will then be prompted for the number of the partition you want to delete. In the case above you want to delete both the Linux and Linux swap partitions.

So type 2

Now you can resize the main partition.

type n to create a new partition.

This new partition needs to be a primary partition so type p.

Next enter 2 when prompted for a partition number.

You will now be prompted for the first sector for the new partition. Enter the start number from the earlier step (the Linux partition)

Next you will be prompted for the last sector you can just hit enter to accept the default which will utilize the remaining disk space.

Type w to save the changes you have made.

Next reboot the system with the following command:

sudo reboot

once the system has reboot and you are back at the commandline enter the following command:

sudo resize2fs /dev/mmcblk0p2

Note: this can take a long time (depending on the card size and speed) be patient and let it finish so you do not mess up the file system and have to start from scratch.

Once it is done reboot the system with the following command:

sudo reboot

You can now verify that the system is using the full capacity of the SD Card by entering the following command:

df -h

Why This Works:

The real magic here is that you delete the root partition, then recreate only the root partition (using the original start sector) before writing the data to the disk. As a result you don't erase the existing data from the root partition.

You then resize (which is safe to run on a mounted disk) the file system to use all the space in the new root partition.

taken from here incase it gets purged:

See also