Warning: session_start(): open(/var/cpanel/php/sessions/alt-php74/sess_7d7afffd94709edb89dbf90b9578d438, O_RDWR) failed: No such file or directory (2) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/alt-php74) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358
How To Mount New Disk Drive To Centos VPS and dedicated Servers

how to mount new disk drive to Centos VPS Server

In this tutorial we are using fdisk  to mount disk drive to your server , this tutorial can be applied for VPS and Dedicated servers too. you can create only up to 2TB partitions with fdisk. Nowadays you may use parted instead.

What is fdisk

fdisk command-line utility provides disk-partitioning functions – for example: preparatory to defining file systems.

Mount Your new Disk Drive to VPS Server

Note that Your OS also should support GPT support in kernel in order to use partitions more than 2TB.

So in this case we use parted and partitions less than 2 TBs. Also please note that in case you are using HW RAID you most likely should rather differ way to manage your partitions. In current case we suppose that there is no hardware RAID controller present in a system . Also this way should be applied to the fully virtualized servers using VPS KVM or XEN-fullHV virtualization technology.

Steps to attach and mount your Disk drive:

First Login to your server using SSH as root privileges.And run the following command :

Lets see the devices in the system

				
					df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 239G 879M 226G 1% /
none 3.9G 0 3.9G 0% /dev/shm

				
			
In this scenario we are going to add the Disk /dev/sdb
				
					fdisk -l
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00083ede
 
Device Boot Start End Blocks Id System /dev/sda1 1 31592 253755392 83 Linux /dev/sda2 31592 32636 8387584 82 Linux swap / Solaris
				
			
Now You will need to run the following command fdisk /dev/sdb
				
					fdisk /dev/sdb
				
			

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disk label Building a new DOS disk label with disk identifier 0x5bac3a50. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won’t be recoverable. Command (m for help):
Now we need to enter n to add a new partition

				
					n
Command action e extended p primary partition (1-4)
#type p for primary partition , 
#then form Partition number (1-4): 
#type 1 and press Enter; 
#and for First cylinder (1-13054, default 1): 
#just press Enter;
#and for the Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054): 
#Press Enter again for default value;

p
Partition number (1-4):1
First cylinder (1-13054, default 1):#Enter
Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Command (m for help):
#Now  type w to write and sync the disk

w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
				
			

The next step is to run mkfs -t ext3 /dev/sdb and confirm the message

				
					mkfs -t ext3 /dev/sdb
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
				
			
The next step is creating directory with name and map the name to the device in the example “DIRECTORY” is the name what we need , start run the following commands:
				
					mkdir /DIRECTORY
e2label /dev/sdb /DIRECTORY
echo “LABEL=/DIRECTORY /DIRECTORY ext3 defaults 1 2” >> /etc/fstab
mount LABEL=/DIRECTORY /DIRECTORY
				
			

To confirm that your drive listed and usable, simply run the following command

				
					df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 239G 879M 226G 1% /
none 3.9G 0 3.9G 0% /dev/shm
/dev/sdb 99G 188M 94G 1% /DIRECTORY

				
			

after all of those commands you can simply access your new drive by run cd /DIRECTORY and use your new drive.

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts