[CentOS] Partition question

Wed Feb 8 14:18:54 UTC 2006
Barry Brimer <barry.brimer at bigfoot.com>

On Tue, 7 Feb 2006, Dan Bulmer wrote:

> We just purchased a new dedicated server outside of the country.  I just
> logged into it (Centos 4.2) and it appears the datacenter formatted it with
> one big partition.  We require a /home partition for our software to
> function.  Typically I install the OS myself on our local machines and
> manually create the /, /home, /var, partitions on setup.
>
> What do I need to do to get a /home partition on this machine remotely?  Can
> it be done?

I assume that the hosting center will assist you by placing a CD in the 
drive.  I am also assuming that the machine is not running a production 
environment yet, or if it is, that it can be taken offline for scheduled 
maintenance.

1.  Have the hosting center boot your system off a bootable Linux CD that 
has support for your hardware.  I usually use Knoppix.

2.  Have the hosting center configure an IP address on the machine.  Have 
them change the password for the "knoppix" user.  Have them start the SSH 
server with the command "/etc/init.d/ssh start".

3.  Open an ssh connection to the machine and log in as the "knoppix" 
user.  Type "sudo su -" to become root.

4.  Verify a connection to some sort of storage that is available to store 
the contents of your drive.

5.  Mount your hard drive with your single large filesystem.

6.  Change directory to the base of the large filesystem and make a tar 
archive of the whole file system and store it on the storage mentioned in 
step 4.

7.  Unmount the original drive

8.  Repartiton and reformat the drive, including swap.  Don't forget to 
create filesystem labels.  You will use them in your new /etc/fstab.  If 
the system indicates that the kernel is using the old partition table, run 
"partprobe"

9.  Create a directory for and mount the new root file system.  Create 
directories under the root filesystem for each new partition.

10.  Mount all of the other newly created partitions in the appropriate 
locations under the new root file system.

11.  Change directory to the root of your new filesystem and extract 
the archive.

12.  Chroot the root directory where you mounted the root file system, and 
then modify the /etc/fstab file to reflect your new partitions.

13.  Verify/update the /etc/grub.conf file and reinstall grub.

14.  Exit the chroot, call the hosting company and reboot the system. 
Have the hosting company remove the CD.

If all goes well(tm), you should have your system in place and should boot 
without a problem.

Hope this helps.

Barry