How To Expand The Raspberry Pi File System

updated: 12/24/2020

Merry Christmas!
We want to keep giving and improving our machine for you! We thought, since it was the season of giving, now is the perfect time to gift you with more file space on your Onefinity CNC!

The article describes how to expand the Onefinity Raspberry Pi image to utilize all the available free space on the SD card. The original SD images were designed to fit a 4gb SD card. Onefinity uses 32gb SD cards, so we can increase the available storage amount from 1.1gbs to 26gbs!

​Materials required:

  • Onefinity CNC Controller
  • USB Keyboard
  • Touchscreen

PLEASE NOTE: It is VERY important to type the following commands EXACTLY as shown. Make sure to include the spaces as well. Even ONE character missing will cause this procedure to fail. Do not perform this expansion if you are uncomfortable with these instructions.

(starting in 2021, we’ll be performing this procedure in house before shipping future machines)

Procedure

  1. Connect the touchscreen and start up the controller as usual. This operation MUST be performed on the touch screen. It will not work if you try to perform it via a network.

  2. Plug in the USB keyboard to one of the free USB ports on the back of the controller.

  3. After the controller boots up, you should see the machine control interface.

Capture

  1. Using the keyboard, hold down the Control key and press the “t” key followed by the “c” key. (Control-t, Control-c) This should open up a new terminal window.

  2. Type the command “df -h” (notice there is a space between the f and the -) into the terminal to see the disk usage (don’t type the quotes). The screenshot below shows the output of the command. In this case, the file system (/dev/root) is 4GB in size and has 1.1GB available but we have a 32GB SD card so we can expand the file system to take advantage of the extra space.

Capture1

  1. Type the command “sudo raspi-config --expand-rootfs” (again, there is a space between g and -) into the terminal. Note the two dashes before the second parameter. You will be prompted for the root password (default is onefinity).

  1. Now we will reboot the Raspberry Pi to take advantage of the new partition. Type “sudo reboot” to reboot the controller.

Capture4

  1. After the controller restarts you can check the new disk usage by opening a terminal (Control-t, Control-c) and typing the command “df -h”. We now have 26GB free space available. Return to the controller interface with Control-t, Control-t.

Capture5

19 Likes

This is a wonderful gift for those files that use a buttload of G0 commands to do what they want to do.

Now I just need to find a suitable keyboard. I’m sure Adafruit or someone like that will have just a perfect mini for me.

3 Likes

You just gave me root on the controller. Merry Christmas indeed!

7 Likes

Don’t break anything :stuck_out_tongue:

7 Likes

@onefinitycnc, any reason this cannot be done over ssh instead of via a keyboard physically attached to the ctonroller?

@Hermsen.BJ - seems like it should work over SSH - I didn’t see anything in there that would terminate the network connection before completion.

1 Like

My be know i can install xbox one controller :thinking: :man_shrugging:

1 Like

@prometheus - folks have had mixed luck with controllers. If you have one, try it. If not, buy the recommended model.

-Tom

Right ?! Now to go set a static IP

@Spectrum24 does your wifi router support fixed/reserved addresses for DHCP? That is how I ensured that my controller gets the same IP address every time. As much as I appreciate having root, I am trying to avoid the temptation of changing things that might get regressed with future software updates. Just a thought…

2 Likes

Are you sure this won’t work remotely? I feel like I did this via network when I build a retro arcade using a PI. My touchscreen stopped working today is why i’m asking.

I did this via ssh remotely.

For customers that are waiting for their orders, will this expansion already be done?

Yes, it will be done at the factory.

I assume the updated software will be as well.

Yes they ship with the latest Firmware as well.

-Alex

@Hermsen.BJ - Just to let you know, I just did it over SSH without a problem (other than I changed my default user name at some point and totally forgot about it).

And for the record, they (Buildbotics) did some seriously screwy things with the default configuration of the Pi.

-Tom

1 Like

I followed this procedure exactly, but after completing, my system only shows size=15g avail=11g.
I was order# 38. Is it possible that some of the early machines were shipped with 16GB SD card instead of 32GB. If so can it be replaced?

It’s possible, as buildbotics was only shipping with a 16gb card and we started sourcing a 32gb after the first batch.
It’s not an easy task, but I would only worry about it if you run out of space.

Thanks for the quick reply.
I don’t plan on storing files on the controller, so it probably won’t be an issue. Just feeling that by being an early buyer, I missed out on a few upgraded items, such as the upgraded memory, upgraded J-Tech Laser, upgraded monitor mount, etc. I actually upgraded to a 15" Asus touch monitor, so the mount will not affect me. Very satisfied with my machine, just venting. Are there any procedures at assembly and testing that were improved as you learned that I should check on my early machine?