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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-15-2009, 04:27 AM
|
#1
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Rep:
|
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?
|
|
|
12-15-2009, 04:31 AM
|
#2
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
12-15-2009, 04:46 AM
|
#3
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Original Poster
Rep:
|
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 ~]#
|
|
|
12-15-2009, 04:58 AM
|
#4
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Original Poster
Rep:
|
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 05:00 AM.
|
|
|
12-15-2009, 05:03 AM
|
#5
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,253
|
Do it from a liveCD.
|
|
|
12-15-2009, 05:07 AM
|
#6
|
Senior Member
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Original Poster
Rep:
|
oops !!!
How to do that?
I never used that?
Any tutorials??
|
|
|
12-15-2009, 05:10 AM
|
#7
|
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
|
Quote:
Originally Posted by your_shadow03
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
|
|
|
All times are GMT -5. The time now is 08:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|