I've installed ubuntu server and successfully running my web server in it. Though I wanna know that my system hard disk space is 1TB which is full with contents available in my website. And I wanna add an external 4TB hard drive to my motherboard but the question is how can I increase the hard drive space where LAMP is installed. I mean I wanna merge the Partition something we can do with AOME Partition Manager with Windows... And if there any other alternative please let me know..


Test this:

Assuming that your external drive is /dev/sdc

Create a table of gpt partition and a partition:

sudo -i
gdisk /dev/sdc

The initial output is a warning if the disk is not a new disk or a disk already using GPT:

GPT fdisk (gdisk) version 0.7.2
Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present
Found invalid GPT and valid MBR; converting MBR to GPT format.
you don't want to convert your MBR partitions to GPT format!
Command (? for help):

When starting gdisk on a disk with existing MBR partitions and no GPT, the program displays a message surrounded by asterisks about converting the existing partitions to GPT.

Type ? and you will see a list of available commands:

Command (? for help):  ? 
b   back up GPT data to a file
c   change a partition's name
d   delete a partition
i   show detailed information on a partition
l   list known partition types
n   add a new partition
o   create a new empty GUID partition table (GPT)
p   print the partition table
q   quit without saving changes
r   recovery and transformation options (experts only)
s   sort partitions
t   change a partition's type code
v   verify disk
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu

Type n to add a new partition and XXXT to give the partition a size.

Partition number (1-128, default 1):  1 
First sector (34-15728606, default = 4605952) or {+-}size{KMGTP}: 
Last sector (4605952-15728606, default = 15728606) or {+-}size{KMGTP}: +4T
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8300
Changed type of partition to 'Linux filesystem

The w writes your changes to disk whilst q command exits without saving your changes:

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N):  y 
OK; writing new GUID partition table (GPT).
The operation has completed successfully.

As gdisk creates partitions not filesystems, you will need to format each of your partitions

mkfs -t ext4 /dev/sdc1

Moves files, usually housed in /var/www to the new partition

mkdir /media/newwww
mount /dev/sdc1 /media/newwww
cp -dpR /var/www/* /media/newwww/
mv /var/www /var/oldwww
mkdir /var/www

Get the UUID

blkid /dev/sdc1

      /dev/sdc1: UUID="c676ae51-cb6f-4c0e-b4a9-76850aafa1d6" TYPE="ext4" 

Edit the file /etc/fstab

nano /etc/fstab

In the file add this line:

UUID=c676ae51-cb6f-4c0e -xxxx-xxxxxxxx /var/www ext4    defaults        0       2

Control + O, save file. Control + X, close nano.

umount /media/newwww
mount /dev/sdc1 /var/www

If everything works correctly deletes the old directory:

sudo -i
rm /var/oldwww
| improve this answer | |
  • thank you.. but this is a bit confusing though I will go through this process ! and Isn't there any software available for ubuntu desktop version to do this process !! or I can reboot to windows os and merge the external new partition with the internal lamp partition and vice versa ?? – Yush Sep 28 '14 at 16:22
  • To merge partitions on internal and external drives you should use lvm partitioning. This procedure seems to me the simplest, though written seem complex. – kyodake Sep 28 '14 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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