FAQ ExpandImage

From embeddedTS Manuals

There are two main paths you can take to achieve this: 1) use the [attachments/grow_sd grow_sd] Linux shell script (see script comments for instructions) or 2) use a GUI application such as gparted to do the work for you.

If you prefer the GUI route, here's a step by step guide to assist you in this process:

This tutorial will walk you through how to use gparted to expand the fourth partition of a Technologic Systems image. Most commonly, this is desired when copying an image meant for a 512MB SD card to a larger SD card like 2GB and you want to take advantage of the full 2GB capacity.

You'll need administrative access to a Linux box and the USB SD card reader. Be sure that your SD card has been inserted into the Linux box and a terminal window is open and we'll get to it...

{content in brackets are comments not to be typed into the terminal}
  1. Become root on the system: {if running Debian based distro:}
   su

   {if running Red Hat based distro:}
   su -
  1. Install the gparted and jfsutils packages: {if running Debian based distro:}
   apt-get install gparted jfsutils
   
   {if running Red Hat based distro:}
   yum install gparted jfsutils
  1. Before we launch gparted, make sure that your SD card is not mounted (otherwise, no changes can be made.): {This is assuming that your SD card is located at "/dev/sdb". Use 'fdisk -l'
    to verify this location}
   umount /dev/sdb*

   {Verify that all partitions have been unmounted. The output should look like 
   the following if they are. If not, run the above command until all four are 
   listed as not mounted}

   [root@DerekLinux ~]# umount /dev/sde*
   umount: /dev/sde: not mounted
   umount: /dev/sde1: not mounted
   umount: /dev/sde2: not mounted
   umount: /dev/sde3: not mounted
   umount: /dev/sde4: not mounted
  1. Launch gparted (remember, you must have root privileges): gparted
  1. Gparted should now be running. In the upper right hand corner of the screen, you'll see a drop down menu. Select "/dev/sde" to select your SD card device. Refer to Screenshot1 below:

Gparted screenshot1.png

  1. The next step is to select/highlight the fourth partition on the SD card in gparted, then select menu item "Partition -> Resize/Move" or click on the large "Resize/Move" button.
  1. Drag the handle on the right side to and stretch it to the end of the grey area. Refer to screenshot2 below:

Gparted screenshot2.png

  1. Select "Resize/Move" and finally "Apply". Refer to screenshot3 below:

Gparted screenshot3.png

At this point, simply allow the gparted program to do its magic and you'll be finished.

If you have problems or errors, it's more than likely a corrupted partition. In this case, you'll need to run the following command:

   jfs_fsck -f /dev/sdb4


Recommended Resources:

Linux Shell Script: [grow_sd]