0

Im tasked to resize a partition on a remote server. I've read up on it and understand that i'll need unmount and use resize2fs /dev/sdato expand the partition size. Can someone please help me unmount the partition or direct me to a guide to achieve this, details of the setup:

UPDATE, the disk space is now 200gb but still need help to expand the partition to its full size

fdisk -l 

outputs

   Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 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: 0x00080e9a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM

Disk /dev/mapper/vg_livecd-lv_root: 18.8 GB, 18832424960 bytes
255 heads, 63 sectors/track, 2289 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/mapper/vg_livecd-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_livecd-lv_swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 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/mapper/vg_livecd-lv_swap doesn't contain a valid partition table

and

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
                       18G  2.8G   15G  17% /
tmpfs                1004M     0 1004M   0% /dev/shm
/dev/sda1             485M   33M  427M   8% /boot
grasshopper
  • 103
  • 1
  • 5
  • 1
    The output you've posted confounds me a little. From the looks of it you've dealing with a 20GB hard drive that is fully allocated. The fact that the root partition is named "vg_livecd" is throwing me. From your setup it looks like you *can't* expand it any more. – Scott Pack May 14 '13 at 13:30
  • @ScottPack thanks you were right, however I still need help to resize the partition – grasshopper May 14 '13 at 14:55
  • uhm, so.... than you have to insert another HDD to your system and then follow my guide below – Pascal Schmiel May 14 '13 at 15:10

1 Answers1

4

in most cases you can resize your filesystem online, there is no need to umount it.

it looks like you are using LVM so in high level your steps are:

  • add another LVM partition to your disk
  • add this partition as a physical volume to your volume group
  • resize your logical volume
  • use resize2fs to expand your filesystem to the new size
Pascal Schmiel
  • 1,738
  • 12
  • 17
  • How can I achieve the first three steps and why is it neccessary? if I just run the command I get `Device or resource busy while trying to open /dev/sda ` – grasshopper May 14 '13 at 13:06
  • * add a new partition using fdisk to your sda and use "Linux LVM" as your partition type (exactly like your sda2) * pvcreate /dev/sdaX (replaxe X with your newly created partition) * vgextend nameOfYourVolumeGroup /dev/sdaX (again replace the X) * lvextend -L +1000M /dev/mapper/vg_livecd-lv_root (replace 1000M with the size of your newly created partition) * resize2fs /dev/mapper/vg_livecd-lv_root – Pascal Schmiel May 14 '13 at 13:13
  • thanks for pointing me in the right direction, Im following this guide to set it up http://www.linuxnetadmin.com/2008/01/how-to-add-disk-space-with-lvm-on-linux.html – grasshopper May 14 '13 at 18:07