Skip to content

Resizing USB mass storage

Szybet edited this page Feb 15, 2024 · 2 revisions

If this first method doesn't work, use the second one. Or just use the second on anyway...

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. Your partition will propably have 500Mb instead of 2.9G. It's just the last partition and you touch only that one. No others

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.

Another way of resizing it - easier but longer:

Using gparted, fix and resize the last partition, then mount it and execute in it:

rm onboard
dd if=/dev/zero of=onboard bs=1M count=2000 
mkfs.vfat onboard

adjust values to your needs

You can do the same thing inside the ereader via ssh when you are rooted (unmount onboard first!), but it will take longer