Resizing USB mass storage

From InkBox
Jump to navigation Jump to search

By default, InkBox comes with a 512 MB virtual partition that can be accessed by PC via USB and be used to store eBooks and other user data. If you are using a microSD card with more than 4 GB of capacity and need more space, it is possible to make this partition larger.

1. Remove the microSD card from your eReader and connect it to a PC. Now the system partition needs to be expanded to fill your card. Find the correct partition name first:

$ lsblk -o <NAME>,<SIZE>

2. You should find a device tree that looks like similar to this:

sdx                     3.6G
├─sdxp1                 19M
├─sdxp2                 500M
├─sdxp3                 128M
└─sdxp4                 2.9G

Note: It is vital to select the right partition or you risk data loss.

3. Make sure the partition sizes match the ones in bold above. Make sure to replace sdxp4 with the correct partition name in all following steps.

4. Resize the fourth partition:

# growpart /dev/sdxp4
# resize2fs /dev/sdxp4
Run lsblk again to confirm the partition has been grown as planned.
$ lsblk -o NAME,SIZE

5. Take the new size of sdxp4 and substract 2.5 GB; the result is the new size you want the USB storage partition file to be and will be needed later.

Now mount the same partition, for example like this:
$ mkdir inkbox && sudo mount -t ext4 /dev/sdxp4 inkboxusb

And finally, expand the USB storage partition file. Take the new size for the partition file from the step before and replace it in this command:

# qemu-img resize ./inkboxusb/onboard X.XG

Unmount the partition:

# umount /dev/sdxp4

Eject the microSD card, insert it into the ereader and put the cover back on. Power on the device. Now you should have the maximum possible space available for USB mode.