extend partition

General support questions
Post Reply
batoo
Posts: 1
Joined: 2014/01/22 04:22:26

extend partition

Post by batoo » 2014/01/22 04:28:29

Hello all,

First of all, i`m so nowbie in Linux.
I have one Centos 6 version on hyper-v. I need to add more free space since i cant update some software there. I successful extended this virtual machine HDD from 6 do 12Gb.

This is my output of fdisk or lvs

Code: Select all

root@cpaneldns [/home]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x00026a31

   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        1045     7875584   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 7021 MB, 7021264896 bytes
255 heads, 63 sectors/track, 853 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/VolGroup-lv_swap: 1040 MB, 1040187392 bytes
255 heads, 63 sectors/track, 126 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

root@cpaneldns [/home]# lvs
  LV      VG       Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_root VolGroup -wi-ao----   6.54g                                           
  lv_swap VolGroup -wi-ao---- 992.00m                                           
root@cpaneldns [/home]#
I don`t know what to do next, but looks like i should extend /dev/mapper/volgroup-lv_root or maybe other :)

Can someone assist me?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: extend partition

Post by TrevorH » 2014/01/22 09:00:26

As root, go into `fdisk /dev/sda` and create a new primary partition (n then p) and tag it (t) as type 0x8e. Write your changes and exit fdisk and then you probably need to reboot to get that seen. When the reboot completes, as root again, run pvcreate on your new partition then use vgextend to add the new PV to your existing Volume Group. Now you have free space available in the VG and you can run lvextend to add some space to /dev/mapper/VolGroup-lv_root and then run `resize2fs /dev/mapper/VolGroup-lv_root`.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply