I've just rented a new server (CentOS 5.4) and I see it has only 3 partitions: /, /boot and the swaping partition.
I'd like to create, at least, partitions for /tmp and /var.

Would there be any problems if I try to create those new partitions through SSH??

Thanks.


Followup:
Since the answers have pointed out it's a risky business to do this, I wonder if creating file-based partitions (as Levi De Haan suggests) would be a good solution in terms of performace, proper isolation and security (in comparison with normal partitions).
Please comment on your experience about this.

link|improve this question

it’s safer than rearranging network devices through SSH… – Mo. May 13 '10 at 22:52
feedback

4 Answers

up vote 1 down vote accepted

Is it possible?

Yes, certainly, but you may have to reuse some space on /boot disable swap, and use the space for your swap partition to setup a alternate install. You would use that alternate install that you will be able to use to manipulate partitions your base install.

I have change partitions on remote systems before, but I don't recommend it. I took a lot of time testing things and simulating on a test system before I touched the live-system.

Would there be any problems, or can it break?

Yes there is a very large opportunity to break things by trying to do this. If you are not extremely familiar with how to partition things and how to configure your boot-loader correctly then I suggest you not even attempt it.

At the very minimum make sure you have a good backup of any data, and a way to have base reinstalled.

If you really thing you need to do this, I strongly suggest you setup a second temporary system or VM which you have local access to and try all the step and work out a step-by-step procedure describing exactly what you need to do before you try it on the remote system.

link|improve this answer
feedback

I had this problem with /tmp not being on a separate partition on a vm ostemplate i am using. what i did instead of formatting the server's hd is create a new partition/file with dd.

dd if=/dev/zero of=newtmp bs=1024 count=102400
mke2fs /dev/newtmp

copy whatever you have out of temp into a different directory temporarily (ironic no?)

/dev/newtmp /tmp ext3 loop,nosuid,noexec,nodev,noatime,rw 0 0
mount -o loop,nosuid,noexec,nodev,noatime,rw /dev/newtmp /tmp 
chmod 1777 /tmp

just to make sure its all good : mount -o remount /tmp

you might want to do this too:

rm -rf /var/tmp
ln -s /tmp /var/tmp

then copy the files back into your temp directory make sure perms and owners are set right and you now have a secure tmp directory.

you could do this for your other partition as well if your purpose is security

link|improve this answer
Please add the double spaces at the end of the command lines for better formatting – GetFree May 13 '10 at 23:15
My purpose is not exactly security but to be able to have more control of the system for better maintainability, and higher reliability by having more isolation. Is this partition-into-a-file thing equivalent in terms of performace to a regular partition? – GetFree May 13 '10 at 23:39
feedback

I certainly wouldn't recommend it. I have a simple rule when partitioning drives, regardless of OS. I do it only when I'm physically at the machine and I have a good backup of anything that could possibly be lost. That way, when things go wrong I'm in a position to fix it. Any of us, and the software we use, can make mistakes.

link|improve this answer
feedback

depends on what you're creating the partitions from.

if you have spare disk space somewhere, sure, it shouldn't cause a problem.

but if you accidentally claim allocated disk space for those partitions, you're going to mess something up, ssh or not.

simple answer; as long as you know what you are doing, you should be fine, mounting new partitions on a live server is possible.

link|improve this answer
No, it's only one hard drive (250 GB) and all space is taken by the 3 existing partitions. – GetFree May 13 '10 at 22:45
your options are playing russian roulette with re-arranging partitions on a live system, where you're not nearby to fix any problems, or as they suggested and you're now looking into, using a file-based partition. – cpbills May 14 '10 at 1:16
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.