I want to connect to a Debian or CentOS device using SSH and modify its whole disk(just one 30 GB disk that has 5 partitions, 5th is Linux root) by writing a new raw disk image file and new partition table on it. My main goal is to make this remotely and automatically.
So I thought maybe I can somehow unmount the root partition and run Python while Linux runs on ram, is this possible?
Are there any alternative or better solution?
Added note: "They are not servers, they are like Raspberry Pi's that we have easy physical access, have SD card like disk that we manually remove, mount on our computers and write a new image then boot to Debian USB and install it on rest of the free space. I am trying to make this easier."