ubuntu - Best way of repartitioning a (running) production server
- by egarcia
I've got an (externally hosted) production server running Ubuntu LTS. It serves webpages (rails) and has an svn repository accesible through Apache, and a PostgreSQL db.
I've got ssh access to the server and root privileges.
Most of the "interesting" stuff is located in /var/ : svn repositories are inside /var/svn, web pages under /var/www, etc.
Yesterday I was curious about how much disk space had it left, so I did the following:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md1 950M 402M 500M 45% /
varrun 990M 64K 990M 1% /var/run
varlock 990M 0 990M 0% /var/lock
udev 990M 76K 989M 1% /dev
devshm 990M 0 990M 0% /dev/shm
/dev/md5 4.7G 668M 4.1G 15% /usr
/dev/md6 4.7G 1.4G 3.4G 29% /var
/dev/md7 221G 28M 221G 1% /home
none 990M 4.0K 990M 1% /tmp
My 'var' partition, which holds most of the interesting part, is only 4.7G big. The /home/ partition, on the other hand, is 221G, but it is mostly unused.
I should have checked the disk layout before starting installing stuff.
Ideally I would need /var/ and /home/ to be "switched" - /home/ should be the one with 4.7G, and /var/ the one with 221G.
Is there a way to solve this without having to reinstall the whole thing?