Repartitioning a server remotely: thoughts on methodology
I got a Duron 1GHz server from RackShack.net recently, but I found the default partition settings to be sub-optimal: / is 6 GB, and /usr is 13 GB. This distributes most of the space in a partition that doesn't need more than 4 GB, taking away a lot of room from /home. I proceeded to see if it's possible to reconfigure the machine's partitions remotely.There's a utility called GNU parted that allows one to resize a machine's partitions, without loosing data. However, no utility can resize a partition while it is mounted! But a partition can't be unmounted while the machine is running. Normally, someone repartitioning a machine would boot from a floppy (so that all the partitions are unmounted), but since I don't have physical access to the machine, I can't do that.
I've come up with a possible way of doing this by tag-teaming the partitions.
Setup a special standalone telnetd that does not need any files other than the executable to run (not even /etc/*). Put the telnetd on both / and /usr, and run both telnetds, each on a different port. Make sure that they both work. Also, copy all the system executables (/bin/*) into /usr. This way, the system has enough functionality available with only one partition online.
Use "fuser" to determine which processes are preventing the / partition from being unmounted. Kill them, being careful not to lock yourself out. Now unmount the / partition, and downsize it to how you want.
Now remount the / partition, and start the special telnetd on it; make sure it works. Then use "fuser" to determine which processes are preventing /usr from being unmounted; kill them, unmount /usr, and now I can resize the rest of the drive.
...All that said, I have not tried this, and I'd rather not, considering the risks involved. I asked RackShack about it and am waiting for a response; they probably have a technician on hand who could repartition the box for me. I thought my stupid idea would be interesting to share, though.