LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-18-2014, 11:28 AM   #1
glennbtn
Member
 
Registered: Dec 2009
Posts: 154

Rep: Reputation: 19
Increasing space ubuntu 12.4 server


Hi All

I have Ubuntu 12.4 server running on proxmox. I have increased the size of the hard drive in proxmox but now need to expand the free space on ubuntu.

Can anyone give me instruction on how to do this in the command line please. Ubuntu is using the default lvm with 3 partitions

Thanks

Glenn
 
Old 11-20-2014, 01:35 AM   #2
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Rep: Reputation: 14
hi glen,
Here's the list of steps for a simple scenario where you have two partitions, /dev/sda1 is an ext4 partition the OS is booted from and /dev/sdb2 is swap. For this exercise we want to remove the swap partition an extend /dev/sda1 to the whole disk.

As always, make sure you have a backup of your data - since we're going to modify the partition table there's a chance to lose all your data if you make a typo, for example.

Run sudo fdisk /dev/sda

use p to list the partitions. Make note of the start cylinder of /dev/sda1
use d to delete first the swap partition (2) and then the /dev/sda1 partition. This is very scary but is actually harmless as the data is not written to the disk until you write the changes to the disk.
use n to create a new primary partition. Make sure its start cylinder is exactly the same as the old /dev/sda1 used to have. For the end cylinder agree with the default choice, which is to make the partition to span the whole disk.
use a to toggle the bootable flag on the new /dev/sda1
review your changes, make a deep breath and use w to write the new partition table to disk. You'll get a message telling that the kernel couldn't re-read the partition table because the device is busy, but that's ok.
Reboot with sudo reboot. When the system boots, you'll have a smaller filesystem living inside a larger partition.

The next magic command is resize2fs. Run sudo resize2fs /dev/sda1 - this form will default to making the filesystem to take all available space on the partition.

That's it, we've just resized a partition on which Ubuntu is installed, without booting from an external drive.
 
Old 11-20-2014, 01:59 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by glennbtn View Post
Can anyone give me instruction on how to do this in the command line please. Ubuntu is using the default lvm with 3 partitions
Not without hard data on your current setup. Disk(s), Partition(s), pvs, vgs, lvs, fstab, ...
Get the picture ?. We're running blind, and you ain't helping.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increasing Swap Space vinay_ks Linux - Newbie 13 07-13-2009 07:36 AM
increasing swap space in SUSE Enterprise Server 10 Sergei Z Linux - Newbie 5 06-01-2007 09:13 PM
Increasing disk space Shankarrajus Fedora 1 04-22-2005 08:12 PM
Increasing swap space rupesh_pulikool Linux - Networking 1 09-12-2004 10:40 PM
Increasing my disk space ekoome Red Hat 6 09-22-2003 04:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration