Note: This guide only applies to Linux dedicated servers with Hosting Control Center. This guide does not apply to any VPS, Cloud server, or any Dedicated server using the My Servers control panel. If you have a Windows dedicated server with Hosting Control Center, see Partition your second harddrive (Windows).
If your Linux server is configured with two hard disks, and you want to partition your second drive, you must:
- Partition the secondary hard disk.
- Create a file system for the new partition.
- Mount the partition to make it accessible.
These instructions are specific to servers setup after July 15, 2005,for servers prior to this, the path in the following steps will need tobe modified slightly. The 'df' command will show you how the currentfilesystem is mounted, normally /dev/hdc was used for the newpartition. For more advanced partitioning and mounting options, pleasesee the vendor provided documentation for your Operating System.
Note: This article assumes you are working with a new, un-formatted disk. If this procedure is followed on a disk that contains data, the data will be destroyed.
To Create a Hard Disk Partition
- Via SSH, log in to your dedicated server as 'root.' See Switching to the Root User on Your Linux Server for information.
- Type the following, and then press Enter.
/sbin/fdisk /dev/sdb
- Type
n
to create a new partition. - For extended or Primary (1-4), type
p
. - Accept the defaults for the partition size.
- Accept the default for the first cylinder.
- Accept the default for last cylinder.
- Type
w
and press Enter to write partition information.
To Create a File System
- Type the following, and then press Enter.
/sbin/mkfs -t ext3 /dev/sdb1
It takes a few minutes to create the new file system on your secondary hard drive.
To Mount the File System
- Type the following, and then press Enter.
cd /sbin
- Type the following, and then press Enter.
mkdir /mnt/disk2
- Type the following, and then press Enter.
chmod 777 /mnt/disk2
- Type the following, and then press Enter.
/bin/mount /dev/sdb1 /mnt/disk2
- To ensure that your dedicated server mounts the new file systemafter each reboot, you need to add the command to mount the new filesystem to /etc/fstab.
- We recommend a backup of /etc/fstab before the update:
• Type the following where mm_dd_yyyy represents the date of the backup, and then press Enter.cp /etc/fstab /etc/fstab_mm_dd_yyyy
• Type the following, and then press Enter.echo "/dev/sdb1 /mnt/disk2 ext3 defaults 0 0" >> /etc/fstab
- Type the following, and then press Enter.
/dev/sdb1 /mnt/disk2 ext3 defaults 0 0