Saturday, December 14, 2019

partitioning - How can I increase hard disk space in ubuntu server




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.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if
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
PARTITIONS!!

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

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...