?
Solved

VMWARE/Linux -Disk increase

Posted on 2011-04-21
28
Medium Priority
?
1,170 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:mnis2008
  • 12
  • 6
  • 5
  • +1
28 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35443301
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
 
LVL 12

Expert Comment

by:upanwar
ID: 35443335
Please show us.

# df -Th

# fdisk -l

# pvscan
0
 

Author Comment

by:mnis2008
ID: 35443347
# 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mnis2008
ID: 35443383
I dont think I have sg3-utils installed.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35443392
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
 

Author Comment

by:mnis2008
ID: 35443393
# pvrescan /dev/sdc1
-bash: pvrescan: command not found
0
 

Author Comment

by:mnis2008
ID: 35443401
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35443417
lvextend -L 200G /dev/mapper/VolGroup00-home
resize2fs /dev/mapper/VolGroup00-home
0
 
LVL 12

Assisted Solution

by:upanwar
upanwar earned 800 total points
ID: 35443502
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
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35443582
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
 
LVL 12

Expert Comment

by:upanwar
ID: 35443609
Thanks wesly_chen to include my missed step to create PV. :)
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35443618
I have mentioned to create PV but forget to write the command, Thanks again
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35443657
Actually if it is LVM2, you could simply extend pv, no need to create an extra PV

pvextend
vgextend
lvextend
resize2fs
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35443696
Hi Farzanj, which version of LVM2?
I use lvm2-2.02.56-8 (CentOS 5.x) and I could not find pvextend command.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35443751
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
 
LVL 31

Expert Comment

by:farzanj
ID: 35443764
So, it should be
pvresize
vgextend
lvextend
resize2fs
0
 

Author Comment

by:mnis2008
ID: 35443802
My pvscan shows they are LVM2, Can you please help me with the steps as pvextend is not working .
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35443903
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
 

Author Comment

by:mnis2008
ID: 35443945
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
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35443958
> 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
 

Author Comment

by:mnis2008
ID: 35444016
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
 

Author Comment

by:mnis2008
ID: 35444029
]# pvcreate /dev/sdc2
  Device /dev/sdc2 not found (or ignored by filtering).
0
 

Author Comment

by:mnis2008
ID: 35444052
How do I check the one I created before
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35444082
fdisk -l /dev/sdc
0
 

Author Comment

by:mnis2008
ID: 35444100
# 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
 
LVL 38

Accepted Solution

by:
wesly_chen earned 1200 total points
ID: 35444116
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
 

Author Comment

by:mnis2008
ID: 35444124
It created it as /dev/sdc4, I will follow your instructions from here
0
 

Author Comment

by:mnis2008
ID: 35444200
It works now...Thanks guys
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Welcome back to our beginners guide of the popular Unix tool, cron. If you missed part one where we introduced this tool, the link is below. We left off learning how to build a simple script to schedule automatic back ups. Now, we’ll learn how to se…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question