Monday, January 02, 2023

octoprint on a G1 hp chromebox, using overmount, and how to remove the overmount again

So i decided that my Anet A8, needed to be hooked up to octoprint.

Now being a cheap bastard, and also wanting something a little more powerful than a Raspberry pi. I also wanted something cheaper, so i ended up getting myself a hp G1 Chromebox.

I then installed GalliumOS on it.

I added a ps3 camera, Octoprint and a couple of other things/plugins.

I added the Arduino Ide, so i could build Marlin directly on the chromebox, for easier firmware updates.

I wanted to run it headless, so i needed something remote

I tried Vnc, and even X forwarding, but all was too slow.

Then i tried RDP, and found out i had to add another user, as the system automatically logged my primary user in.

So now i have a remote system, that seems to be running

Then i decided to update Octoprint, to a newer version, and at about the same time, i decided it was time to give Klipper firmware a go.

but before getting all things needed, the 16 Gb M2 drive, of the box, got dangerously close to being full.. 

So i decided to add a USB drive, 64Gb, split into 4 partitions, that i would then over mount to /usr /var /snap and /Home.

So i started by creating 4x partitions, 16 Gb using Fdisk, formatting them to ext4

Then i did 

cd /mnt

mkdir snap usr var home

mount /dev/sdb1 snap

mount /dev/sdb2 usr

mount /dev/sdb3 var

mount /dev/sdb4 home

cp -a /snap /mnt/snap

cp -a /usr /mnt/usr

cp -a /var /mnt/var

cp -a /home /mnt/home

edited /etc/fstab to include the uuid of the partitions ( your uuid will vary)

#OverMount

UUID=e6e31d6b-c063-47d2-ad39-ff48c7629d8b /snap ext4 noatime 0 1

UUID=67687f2c-f74d-489a-b8ce-eb44d3a7ab3f /usr ext4 noatime 0 1

UUID=8bbae8d6-7a03-4aad-bc07-80d7c1aeb514 /home ext4 noatime 0 1

UUID=94c1be23-18d0-4825-9e17-d9eef87b076c /var ext4 noatime 0 1

#For later use 

#UUID=e6e31d6b-c063-47d2-ad39-ff48c7629d8b /mnt/snap ext4 noatime 0    1

#UUID=67687f2c-f74d-489a-b8ce-eb44d3a7ab3f /mnt/usr ext4 noatime 0 1

#UUID=8bbae8d6-7a03-4aad-bc07-80d7c1aeb514 /mnt/home ext4 noatime 0  1

#UUID=94c1be23-18d0-4825-9e17-d9eef87b076c /mnt/var ext4 noatime 0 1


 and rebooted

I Now have a functional but slow system.

but That wasn't enough. I wanted speed and space.

So for christmas, i got at 240 gb M2 drive ( a Trandcend TS240GMTS420S to be exact) , in just the right physical size, to fit into the ChromeBox... YEESS, Go Wifey.

Any how, now to figure out, howto transfer the system.

I did some googling, and decided to get me a ventoy usb drive, with clonezilla and systemRescueCD , to do my biddings.

So off to the boxes i went, and found a 32Gb stick.

Got my headless box connected to a keyboard/mouse/screen, and tried booting from the usb drive.

Got i going using cloneZilla.

No luck on mounting the Ventoy USb for storage though, and since i don´t have a USB M2 adaptor, i needed to transfer the disk to something as an image.

Well come to find out, that Ventoy blocks the drive its on.

Now if i use, load to RAM, while loading Either CloneZille or systemRescueCD , i should be able to remove the ventoy drive, replace it, and use it as storage, but i just didn't have any luck. (Perhaps i should have done the to ram thing from the ventoy menu, instead of from the native CZ/SRCD menus ?)

So instead i checked the disk usage, of the original 64Gb drive.

I figured out, that if i moved the content of /home and /var, to the /Snap partition. i would have enough storage to make an image of /dev/sda

So that´s what i did. Booted into systemRescueCD ToRam 

cd /mnt 

mkdir snap home usr

Mount /dev/sdb1 snap

Mount /dev/sdb3 var

Mount /dev/sdb4 home

cd /mnt/snap

mkdir usr home

rsync -av /mnt/home/ /mnt/snap/home/

rsync -av /mnt/var/ /mnt/snap/var/


Then i removed the home and usr partitions, and replaced them with one new one, using Fdisk

Then

mkdir /mnt/sda

mount /dev/sdb3 /mnt/sda

and then i tried using partimage,  but it failed.

So i fell back to good old dd using -bs 64kb for speed

dd -if /dev/sda -of /mnt/sda/sda.img -bs 64kb

Aaaand about 1,5 hours later, i had myself a little image.

Then i opened the box, replaced the disk.

Got some errors from the "bios" showing that the disk didn't have any efi, and as this was correct i just started systemRescueCD ToRam again

Then i did 

cd /mnt 

mkdir snap usr sdb3

Mount /dev/sdb1 snap

Mount /dev/sdb2 usr

Mount /dev/sdb3 sdb3

cd sdb3

Then restoring the image

dd -if sda.img -of /dev/sda -bs 64kb

And again waited for about 2-3 hours

Now i had a system, that would probably boot, but not much more

Into the Gui, and opened Gparted

See how the disk looked.

Gparted gave me some error, that i ignored for now.

I verified that i had an Efi partition, and a ext4 partition.

Then grew the  Ext4 partition, letting Gparted fix the error, whatever i was (something to do with GPT)

Now i was almost done.

Opened a terminal and did

mkdir /mnt/sda

mount /dev/sda2 /mnt/sda

rsync -av /mnt/snap/home/ /mnt/sda/home/

rsync -av /mnt/snap/var/ /mnt/sda/var/

rsync -av /mnt/usr/ /mnt/sda/usr/

rsync -av /mnt/snap/ /mnt/sda/snap/

Now doing the last rsync, would copy both home and var, to where they didn't belong, but i didn't want to risk data loss if it did not work.

So to finish up i did

rm -rf /mnt/sda/snap/home /mnt/sda/snap/var

once all this was done, i did a

shutdown -h  

Once shut down, i removed the usb devices, started the chromebox and hoped.

and up she went.

Now what was it i was doing, before all this data storage playing had to happen ??