VMWARE/Linux -Disk increase

I have a linux hosted on vmware. My Volumegroup was on 2 disks and we needed more space. We went ahead and increase  disk space in vmware, How do I reflect the changes on the server.
mnis2008Asked:
Who is Participating?
 
wesly_chenCommented:
Then
# pvcreate /dev/sdc4

3. check the size of /dev/sdc4
# pvdisplay /dev/sdc4

4. Add PV (/dev/sdc4) into /dev/mapper/VolGroup00
# vgextend VolGroup00 /dev/sdc4

5. Extend the Logic Volume of /dev/mapper/VolGroup00-home
# lvextend -L 200G /dev/VolGroup00/home

6. Extend the filesystem
# resize2fs /dev/VolGroup00/home
0
 
farzanjCommented:
1. What OS in running on your VMware?  Linux type & version?
2. Please show the server file system.

df -hT

3. And specify which file system should increase in size and by how much.
0
 
upanwarCommented:
Please show us.

# df -Th

# fdisk -l

# pvscan
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
mnis2008Author Commented:
# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-root
              ext3    992M  485M  456M  52% /
/dev/mapper/VolGroup00-home
              ext3     26G   35M   24G   1% /home
/dev/mapper/VolGroup00-admin
              ext3    992M   34M  908M   4% /admin
/dev/mapper/VolGroup00-tmp
              ext3    992M   34M  907M   4% /tmp
/dev/mapper/VolGroup00-opt
              ext3    2.0G  591M  1.3G  32% /opt
/dev/mapper/VolGroup00-apps
              ext3    992M   34M  908M   4% /apps
/dev/mapper/VolGroup00-usr
              ext3    3.0G  1.7G  1.2G  59% /usr
/dev/mapper/VolGroup00-var
              ext3    3.0G  414M  2.4G  15% /var
/dev/mapper/VolGroup00-varlog
              ext3    992M   88M  853M  10% /var/log
/dev/mapper/VolGroup00-varlogaudit
              ext3    992M  440M  502M  47% /var/log/audit
/dev/sda1     ext3     99M   26M   69M  27% /boot
tmpfs        tmpfs    250M     0  250M   0% /dev/shm
/dev/mapper/VolGroup00-ftptransfers
              ext3    5.0G  139M  4.6G   3% /ftptransfers

# fdisk -l

Disk /dev/sda: 24.6 GB, 24696061952 bytes
255 heads, 63 sectors/track, 3002 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104358+  83  Linux
/dev/sda2              14        3002    24009142+  8e  Linux LVM

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         522     4192901   8e  Linux LVM
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(0, 1, 1) logical=(0, 2, 3)

Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        7832    62910508+  8e  Linux LVM

# pvscan
  PV /dev/sdb1   VG VolGroup01   lvm2 [3.97 GB / 0    free]
  PV /dev/sda2   VG VolGroup00   lvm2 [22.88 GB / 0    free]
  PV /dev/sdc1   VG VolGroup00   lvm2 [59.97 GB / 37.84 GB free]
  Total: 3 [86.81 GB] / in use: 3 [86.81 GB] / in no VG: 0 [0   ]

Thanks
0
 
mnis2008Author Commented:
I dont think I have sg3-utils installed.
0
 
upanwarCommented:
Your Disk /dev/sdc: 214.7 GB seems increased as well as your VG VolGroup00 is also having free space, Please update which FS you want to increase with what size so then we can suggest you steps.
0
 
mnis2008Author Commented:
# pvrescan /dev/sdc1
-bash: pvrescan: command not found
0
 
mnis2008Author Commented:
I want to increase /home, Initially I increase by 26G but it was not sufficient. I want /home to show up as 200G.
Thanks
0
 
farzanjCommented:
lvextend -L 200G /dev/mapper/VolGroup00-home
resize2fs /dev/mapper/VolGroup00-home
0
 
upanwarCommented:
Before running command.

lvextend -L 200G /dev/mapper/VolGroup00-home
resize2fs /dev/mapper/VolGroup00-home


You need to create PV and increase the VG, to do that follow the below given steps.

# fdisk /dev/sdc

press n to create new partition and follow the instructions.

It will create new partion name /dev/sdc2

then execute below given command to extent the VG.

# vgextend VolGroup00 /dev/sdc2

Now you need to extend the LV by below given command.

# lvextend -L 200G /dev/VolGroup00/home

Then increase the FS.

# resize2fs /dev/VolGroup00/home

Update if you face any challenge to perform this.

0
 
wesly_chenCommented:
1. Add one partition on /dev/sdc
# fdisk /dev/sdc
n  (add new partition)
p (primary partition)
<enter>
<enter>
<enter>   (bascially it use up the rest of free space on /dev/sdc)
t  (change partition type)
8e (PV)
w (write the change)

2. new partition should be /dev/sdc2
# pvcreate /dec/sdc2


3. check the size of /dev/sdc2
# pvdisplay /dev/sdc2

4. Add PV (/dev/sdc2) into /dev/mapper/VolGroup00
# vgextend VolGroup00 /dev/sdc2

5. Extend the Logic Volume of /dev/mapper/VolGroup00-home
# lvextend -L 200G /dev/mapper/VolGroup00-home

6. Extend the filesystem
# resize2fs /dev/mapper/VolGroup00-home
0
 
upanwarCommented:
Thanks wesly_chen to include my missed step to create PV. :)
0
 
upanwarCommented:
I have mentioned to create PV but forget to write the command, Thanks again
0
 
farzanjCommented:
Actually if it is LVM2, you could simply extend pv, no need to create an extra PV

pvextend
vgextend
lvextend
resize2fs
0
 
wesly_chenCommented:
Hi Farzanj, which version of LVM2?
I use lvm2-2.02.56-8 (CentOS 5.x) and I could not find pvextend command.
0
 
farzanjCommented:
Hi Wesly,

I thought I saw it but right now I can only find pvresize.  I would double check it later.  I have actually done this.

http://linux.die.net/man/8/pvresize
0
 
farzanjCommented:
So, it should be
pvresize
vgextend
lvextend
resize2fs
0
 
mnis2008Author Commented:
My pvscan shows they are LVM2, Can you please help me with the steps as pvextend is not working .
0
 
wesly_chenCommented:
In order for pvresize to work is that the partition /dev/sdc1 need to be resized first.
Currently /dev/sdc1 is 60GB and /dev/sdc have 200GB.

It need to use "parted" to resize the partition first.
http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html
0
 
mnis2008Author Commented:
Hello Chen,
I think I will better partition my disk and create a new volume but I encounter an error
# fdisk /dev/sdc

The number of cylinders for this disk is set to 26108.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 4
First cylinder (7833-26108, default 7833):
Using default value 7833
Last cylinder or +size or +sizeM or +sizeK (7833-26108, default 26108):
Using default value 26108

Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): L

 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       bf  Solaris
 1  FAT12           24  NEC DOS         81  Minix / old Lin c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          82  Linux swap / So c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c7  Syrinx
 5  Extended        41  PPC PReP Boot   85  Linux extended  da  Non-FS data
 6  FAT16           42  SFS             86  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  EFI GPT
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

# pvcreate /dec/sdc2
  Device /dec/sdc2 not found (or ignored by filtering).

Open in new window

0
 
wesly_chenCommented:
> WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
> The kernel still uses the old table.
> The new table will be used at the next reboot.

In this case, reboot the VM.
0
 
mnis2008Author Commented:
After the reboot, This is what I see, so should I run a pvcreate now


# pvscan
  PV /dev/sdb1   VG VolGroup01   lvm2 [3.97 GB / 0    free]
  PV /dev/sda2   VG VolGroup00   lvm2 [22.88 GB / 0    free]
  PV /dev/sdc1   VG VolGroup00   lvm2 [59.97 GB / 37.84 GB free]
  Total: 3 [86.81 GB] / in use: 3 [86.81 GB] / in no VG: 0 [0   ]
[root@lpv042 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               VolGroup01
  PV Size               4.00 GB / not usable 30.63 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              127
  Free PE               0
  Allocated PE          127
  PV UUID               8E781D-N6LZ-JQWk-ZXWf-R1WP-8d4r-HqrXBU

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup00
  PV Size               22.90 GB / not usable 22.43 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              732
  Free PE               0
  Allocated PE          732
  PV UUID               Z8nPcb-ggmA-9kVL-GGZL-Q7I4-q2MI-BxcUD7

  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               VolGroup00
  PV Size               60.00 GB / not usable 28.04 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              1919
  Free PE               1211
  Allocated PE          708
  PV UUID               ijmOcX-f3RR-mnPZ-mvAG-mkJV-WHQ2-qT8P6q

0
 
mnis2008Author Commented:
]# pvcreate /dev/sdc2
  Device /dev/sdc2 not found (or ignored by filtering).
0
 
mnis2008Author Commented:
How do I check the one I created before
0
 
wesly_chenCommented:
fdisk -l /dev/sdc
0
 
mnis2008Author Commented:
# fdisk -l /dev/sdc

Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        7832    62910508+  8e  Linux LVM
/dev/sdc4            7833       26108   146801970   8e  Linux LVM
0
 
mnis2008Author Commented:
It created it as /dev/sdc4, I will follow your instructions from here
0
 
mnis2008Author Commented:
It works now...Thanks guys
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.