LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2009, 05:27 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Rep: Reputation: 51
Adding a new Space to LVM ?


I am in verse to add a new Hard Drive to my Linux Box.
All I have a new Hard Disk added and shown below:
Code:
[root@localhost ~]# fdisk -l

Disk /dev/sda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         391     3036285   8e  Linux LVM

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
Code:
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      2.4G  2.1G  125M  95% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  125M     0  125M   0% /dev/shm
Code:
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2.88 GB
  PE Size               32.00 MB
  Total PE              92
  Alloc PE / Size       92 / 2.88 GB
  Free  PE / Size       0 / 0
  VG UUID               IQj7ho-fYeh-Le0g-RNvf-dVJ7-7W2i-jmICey

[root@localhost ~]#
How Can I add more space to / partition?
 
Old 12-15-2009, 05:31 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
I can never remember how to do that, and always end up googling for a tutorial. Here's one that google presented just now.

http://tldp.org/HOWTO/LVM-HOWTO/recipeadddisk.html

Cheers,

Evo2.
 
Old 12-15-2009, 05:46 AM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Thanks evo2 that was superb docs.
I followed the link and am now stuck at the resizing point.
Ho can I do it online.
Code:
ADDING A NEW SPACE TO LVM
----------------------------------------------------

[root@localhost ~]# fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-783, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-783, default 783): +300MB

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   83  Linux

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

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   83  Linux
/dev/sdb2              38         338     2417782+  83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   83  Linux
/dev/sdb2              38         338     2417782+  83  Linux

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   8e  Linux LVM
/dev/sdb2              38         338     2417782+  83  Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   8e  Linux LVM
/dev/sdb2              38         338     2417782+  8e  Linux LVM

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#

[root@localhost ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created
[root@localhost ~]# fdisk -l

Disk /dev/sda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         391     3036285   8e  Linux LVM

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          37      297171   8e  Linux LVM
/dev/sdb2              38         338     2417782+  8e  Linux LVM
[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup00
  PV Size               2.90 GB / not usable 21.12 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              92
  Free PE               0
  Allocated PE          92
  PV UUID               3SFLy5-8aup-WXuH-EGj0-V2Zz-jqq1-fqHdtM

  "/dev/sdb1" is a new physical volume of "290.21 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name
  PV Size               290.21 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               1lZhYP-tNoD-2wCL-5IQJ-DOe6-yK1E-eH10fR

  "/dev/sdb2" is a new physical volume of "2.31 GB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb2
  VG Name
  PV Size               2.31 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               EtOdWR-JfG2-l3a9-V6eg-haLY-1jO0-myL80M

[root@localhost ~]#

[root@localhost ~]# vgextend VolGroup00-LogVol00 /dev/sdb1
  Volume group "VolGroup00-LogVol00" not found
[root@localhost ~]# vgextend VolGroup00  /dev/sdb1
  Volume group "VolGroup00" successfully extended
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      2.4G  2.1G  125M  95% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  125M     0  125M   0% /dev/shm
[root@localhost ~]# vgextend VolGroup00  /dev/sdb2
  Volume group "VolGroup00" successfully extended
[root@localhost ~]# pvscan
  PV /dev/sda2   VG VolGroup00   lvm2 [2.88 GB / 0    free]
  PV /dev/sdb1   VG VolGroup00   lvm2 [288.00 MB / 288.00 MB free]
  PV /dev/sdb2   VG VolGroup00   lvm2 [2.28 GB / 2.28 GB free]
  Total: 3 [5.44 GB] / in use: 3 [5.44 GB] / in no VG: 0 [0   ]
[root@localhost ~]#
 
Old 12-15-2009, 05:58 AM   #4
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
I did tried with:
Code:
[root@localhost ~]# lvextend -L+300M /dev/VolGroup00/LogVol00
  Rounding up size to full physical extent 320.00 MB
  Extending logical volume LogVol00 to 2.69 GB
  Logical volume LogVol00 successfully resized
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      2.4G  2.1G  125M  95% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  125M     0  125M   0% /dev/shm
[root@localhost ~]# fdisk -l
Bot no improvement.
Please help with the same.
I read resize2fs is the command but the command says:

Code:
[root@localhost ~]# resize2fs -f /dev/VolGroup00/LogVol00
resize2fs 1.35 (28-Feb-2004)
/dev/VolGroup00/LogVol00 is mounted; can't resize a mounted filesystem!
I cant unmount the / partition Right?
Whats the Issue here?

Last edited by your_shadow03; 12-15-2009 at 06:00 AM.
 
Old 12-15-2009, 06:03 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Do it from a liveCD.
 
Old 12-15-2009, 06:07 AM   #6
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
oops !!!

How to do that?
I never used that?
Any tutorials??
 
Old 12-15-2009, 06:10 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Quote:
Originally Posted by your_shadow03 View Post
oops !!!

How to do that?
I never used that?
Any tutorials??
Hi,

Here's a very easy to follow step by step guide that covers almost everything you need. http://www.howtoforge.com/linux_lvm

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Centos 5.2 LVM - Not Enough Space dschornack Linux - Server 5 08-07-2008 06:33 PM
LVM to increase folder space kool_kid Linux - Server 8 03-09-2008 06:05 PM
Adding new HD to LVM volume? Yig Linux - Hardware 1 01-30-2008 03:08 AM
Using LVM and adding a drive reeseslover531 Fedora 3 09-30-2006 12:03 PM
Adding drive with LVM DBabo Linux - Software 2 06-11-2005 11:06 PM


All times are GMT -5. The time now is 08:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration