Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Debian in a VMware VM and LVM (http://www.linux-archive.org/debian-user/644121-debian-vmware-vm-lvm.html)

Bonno Bloksma 03-13-2012 01:52 PM

Debian in a VMware VM and LVM
 
Hi,

I have been using Linux for several years but now I have another learning moment. ;-) I have read several LVM howto sites but still run into things I do not understand.
Can someone please answer the 4 embedded questions and tell me what I(?) did wrong.

Using the 6.0.4 amd netinst CD I created a small 10GB virtual machine (VM). I then realized I needed it to be a bit bigger so I wanted to extend the LVM environment and add that space to the /var logical volume.
Of course as this is a new VM I just could have started from scratch but I am trying to learn something as well. ;-)

First I had a look at the current disk layout using fdisk -l

root@wwwgw:~# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x000d6e97

Device Boot Start End Blocks Id System
/dev/sda1 1 37 291840 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 37 1306 10190849 5 Extended
/dev/sda5 37 1306 10190848 8e Linux LVM

1)
Why the warning about the 300MB /boot partition not ending on a cylinder boundary? I used the manual setup in the Debian 6.0.4 installation and told it to create a 300MB partition at the beginning of the disk. Did the installation software do something wrong or should I have know something I do not know yet?

2)
After that came a lot of warnings about /dev/dm-0, /dev/dm-1, /dev/dm-2, /dev/dm-3 and /dev/dm-4. I know those are LVM2 devices but...
Why is fdisk (still) seeing them as disks/partitions it has to show during a listing, and then complain they are not valid?


At the VMware level I increased the disk from 10GB to 12GB. Using cfdisk, which in my opinion gives less cause for a user error, I created a new logical sda6 partition in the free space. The end result is:
root@wwwgw:~# 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: 0x000d6e97

Device Boot Start End Blocks Id System
/dev/sda1 1 37 291840 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 37 1566 12285008 5 Extended
/dev/sda5 37 1306 10190848 8e Linux LVM
/dev/sda6 1306 1566 2094127+ 8e Linux

3)
Why is there a + at the end of the number of blocks?

I then want to make the sda6 partition a LVM physical volume using
root@wwwgw:~# pvcreate /dev/sda6
Device /dev/sda6 not found (or ignored by filtering).
root@wwwgw:~#
indeed, there is no /dev/sda6 yet.

4)
Why is /dev/sda6 not there yet? What step am I missing?


Ok, after a reboot (it is not a production server yet) the /dev/sda6 is there.
Form here on it was (almost) straight sailing. ;-)

root@wwwgw:~# pvcreate /dev/sda6
Physical volume "/dev/sda6" successfully created
root@wwwgw:~# vgextend vgroup1 /dev/sda6
Volume group "vgroup1" successfully extended

Then to runlevel 1 to make sure (almost) nothing is using the /var directory tree
and
root@wwwgw:~# lvextend -l+2G /dev/vgroup1/lvvar
Extending logical volume lvvar to 3.86GiB
Logical volume lvvar successfully resized

root@wwwgw:~# umount /var
Then first a filesystem check as that seems to be needed before resizing. Not doing so will give me a warning although this was not mentioned in the HOWTOs I have read.
root@wwwgw:~# fsck -f /dev/vgroup1/lvvar
root@wwwgw:~# resize2fs /dev/vgroup1/lvvar
root@wwwgw:~# mount /var

and back to runlevel 2


Anything else I missed?

Bonno Bloksma


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 89D1798A7351D040B4E74E0A043C69D70103C42C@EinExch-01.tio.nl">http://lists.debian.org/89D1798A7351D040B4E74E0A043C69D70103C42C@EinExch-01.tio.nl

Keith McKenzie 03-13-2012 03:26 PM

Debian in a VMware VM and LVM
 
On 13/03/12 14:52, Bonno Bloksma wrote:

4)
Why is /dev/sda6 not there yet? What step am I missing?


Ok, after a reboot (it is not a production server yet) the /dev/sda6 is there.
Form here on it was (almost) straight sailing.;-)


I would imagine that is because your kernel is/was still using the old
partition table; until you rebooted.


(Don't know about LVM)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4F5F7552.2070403@gmail.com">http://lists.debian.org/4F5F7552.2070403@gmail.com

Tom H 03-13-2012 05:07 PM

Debian in a VMware VM and LVM
 
On Tue, Mar 13, 2012 at 10:52 AM, Bonno Bloksma <b.bloksma@tio.nl> wrote:



> I have been using Linux for several years but now I have another learning
> moment. ;-) I have read several LVM howto sites but still run into things I
> do not understand.
> Can someone please answer the 4 embedded questions and tell me what
> I(?) did wrong.
>
> Using the 6.0.4 amd netinst CD I created a small 10GB virtual machine
> (VM). I then realized I needed it to be a bit bigger so I wanted to extend
> the LVM environment and add that space to the /var logical volume.
> Of course as this is a new VM I just could have started from scratch
> but I am trying to learn something as well. ;-)
>
> First I had a look at the current disk layout using fdisk -l
>
> root@wwwgw:~# fdisk -l
>
> Disk /dev/sda: 10.7 GB, 10737418240 bytes
> 255 heads, 63 sectors/track, 1305 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: 0x000d6e97
>
> * Device Boot * * *Start * * * * End * * *Blocks * Id *System
> /dev/sda1 * * * * * * * 1 * * * * *37 * * *291840 * 83 *Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2 * * * * * * *37 * * * *1306 * *10190849 * *5 *Extended
> /dev/sda5 * * * * * * *37 * * * *1306 * *10190848 * 8e *Linux LVM
>
> 1)
> Why the warning about the 300MB /boot partition not ending on a cylinder
> boundary? I used the manual setup in the Debian 6.0.4 installation and
> told it to create a 300MB partition at the beginning of the disk. Did
> the installation software do something wrong or should I have know
> something I do not know yet?

I've never liked this message and I therefore partition manually.
Someone else on the list might know whether you can incur a
performance hit on a "regular" disk; you certainly do with an SSD or
an "advanced format" disk. The wheezy installer corrects this and
starts at 2048 (units=sectors).



> 2)
> After that came a lot of warnings about /dev/dm-0, /dev/dm-1, /dev/dm-2,
> /dev/dm-3 and /dev/dm-4. I know those are LVM2 devices but...
> Why is fdisk (still) seeing them as disks/partitions it has to show during
> a listing, and then complain they are not valid?

I assume that "fdisk -l" goes through "/proc/partitions" and displays
the information that it can about its contents.

It doesn't recognize the device mapper devices because they are
virtual block devices created by dmsetup/lvm within a "real"/physical
block device.



> At the VMware level I increased the disk from 10GB to 12GB. Using
> cfdisk, which in my opinion gives less cause for a user error, I created
> a new logical sda6 partition in the free space. The end result is:
> root@wwwgw:~# 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: 0x000d6e97
>
> * Device Boot * * *Start * * * * End * * *Blocks * Id *System
> /dev/sda1 * * * * * * * 1 * * * * *37 * * *291840 * 83 *Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2 * * * * * * *37 * * * *1566 * *12285008 * *5 *Extended
> /dev/sda5 * * * * * * *37 * * * *1306 * *10190848 * 8e *Linux LVM
> /dev/sda6 * * * * * *1306 * * * *1566 * * 2094127+ *8e *Linux

I've always assumed that it meant that the partition's size is between
2094127 and 2094128 blocks but assumption can be the mother of all
<deleted>!



> 3)
> Why is there a + at the end of the number of blocks?
>
> I then want to make the sda6 partition a LVM physical volume using
> root@wwwgw:~# pvcreate /dev/sda6
> *Device /dev/sda6 not found (or ignored by filtering).
> root@wwwgw:~#
> indeed, there is no /dev/sda6 yet.
>
> 4)
> Why is /dev/sda6 not there yet? What step am I missing?

I've never used cfdisk; don't you get a message that the kernel's
still using the old partition table?



> Ok, after a reboot (it is not a production server yet) the /dev/sda6 is there.
> Form here on it was (almost) straight sailing. ;-)

No need to reboot; partprobe or kpartx can load the new partition table for you.



> root@wwwgw:~# pvcreate /dev/sda6
> *Physical volume "/dev/sda6" successfully created
> root@wwwgw:~# vgextend vgroup1 /dev/sda6
> *Volume group "vgroup1" successfully extended
>
> Then to runlevel 1 to make sure (almost) nothing is using the /var directory tree
> and
> root@wwwgw:~# lvextend -l+2G /dev/vgroup1/lvvar
> *Extending logical volume lvvar to 3.86GiB
> *Logical volume lvvar successfully resized
>
> root@wwwgw:~# umount /var
> Then first a filesystem check as that seems to be needed before resizing. Not doing so will give me a warning although this was not mentioned in the HOWTOs I have read.
> root@wwwgw:~# fsck -f /dev/vgroup1/lvvar
> root@wwwgw:~# resize2fs /dev/vgroup1/lvvar
> root@wwwgw:~# mount /var
>
> and back to runlevel 2

I'm surprised that you were able to unmount "/var", even in runlevel
1, but I assume that it depends on your setup. Running fsck is a good
idea. You can also do so after "resize2fs ...".

I'd have booted via the network, a rescue CD, or a live CD to do this.
You could probably even do this via the initramfs (untested!).


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAOdo=Sw34O7hmYPcybkZhpntNfewoMjYWq96saAUrTWFxBnG_ g@mail.gmail.com">http://lists.debian.org/CAOdo=Sw34O7hmYPcybkZhpntNfewoMjYWq96saAUrTWFxBnG_ g@mail.gmail.com

Bob Proulx 03-16-2012 07:21 AM

Debian in a VMware VM and LVM
 
Bonno Bloksma wrote:
> indeed, there is no /dev/sda6 yet.
> Why is /dev/sda6 not there yet? What step am I missing?

Next time run 'partprobe' to request the OS to re-read the partition
table.

> root@wwwgw:~# umount /var
> Then first a filesystem check as that seems to be needed before resizing. Not doing so will give me a warning although this was not mentioned in the HOWTOs I have read.
> root@wwwgw:~# fsck -f /dev/vgroup1/lvvar
> root@wwwgw:~# resize2fs /dev/vgroup1/lvvar
> root@wwwgw:~# mount /var

It is not necessary to unmount a logical volume before resizing it.
Online resizing is supported and works well. Simply resize it.

Bob

Michael Tsang 03-16-2012 10:16 AM

Debian in a VMware VM and LVM
 
On Tuesday 13 March 2012 22:52:01 Bonno Bloksma wrote:
>
> Using the 6.0.4 amd netinst CD I created a small 10GB virtual machine (VM).
> I then realized I needed it to be a bit bigger so I wanted to extend the
> LVM environment and add that space to the /var logical volume. Of course
> as this is a new VM I just could have started from scratch but I am trying
> to learn something as well. ;-)
>
> First I had a look at the current disk layout using fdisk -l
>
> root@wwwgw:~# fdisk -l
>
> Disk /dev/sda: 10.7 GB, 10737418240 bytes
> 255 heads, 63 sectors/track, 1305 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: 0x000d6e97
>
> Device Boot Start End Blocks Id System
> /dev/sda1 1 37 291840 83 Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2 37 1306 10190849 5 Extended
> /dev/sda5 37 1306 10190848 8e Linux LVM
>
> 1)
> Why the warning about the 300MB /boot partition not ending on a cylinder
> boundary? I used the manual setup in the Debian 6.0.4 installation and
> told it to create a 300MB partition at the beginning of the disk. Did the
> installation software do something wrong or should I have know something I
> do not know yet?
Older versions of fdisk by default aligns to cylinder. This is deprecated and
not the case now. Simply suppress this warning by using -cu
>
> 2)
> After that came a lot of warnings about /dev/dm-0, /dev/dm-1, /dev/dm-2,
> /dev/dm-3 and /dev/dm-4. I know those are LVM2 devices but... Why is fdisk
> (still) seeing them as disks/partitions it has to show during a listing,
> and then complain they are not valid?
>
I think this is a bug in fdisk.
>
> At the VMware level I increased the disk from 10GB to 12GB. Using cfdisk,
> which in my opinion gives less cause for a user error, I created a new
> logical sda6 partition in the free space. The end result is: root@wwwgw:~#
> 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: 0x000d6e97
>
> Device Boot Start End Blocks Id System
> /dev/sda1 1 37 291840 83 Linux
> Partition 1 does not end on cylinder boundary.
> /dev/sda2 37 1566 12285008 5 Extended
> /dev/sda5 37 1306 10190848 8e Linux LVM
> /dev/sda6 1306 1566 2094127+ 8e Linux
>
> 3)
> Why is there a + at the end of the number of blocks?
In fdisk, a block is 1024 bytes. The partition does not contain integral
number of blocks, hence the + sign.
>
> I then want to make the sda6 partition a LVM physical volume using
> root@wwwgw:~# pvcreate /dev/sda6
> Device /dev/sda6 not found (or ignored by filtering).
> root@wwwgw:~#
> indeed, there is no /dev/sda6 yet.
>
> 4)
> Why is /dev/sda6 not there yet? What step am I missing?
You should run partprobe(8) or reboot your machine.
>
>
> Ok, after a reboot (it is not a production server yet) the /dev/sda6 is
> there. Form here on it was (almost) straight sailing. ;-)
>
> root@wwwgw:~# pvcreate /dev/sda6
> Physical volume "/dev/sda6" successfully created
> root@wwwgw:~# vgextend vgroup1 /dev/sda6
> Volume group "vgroup1" successfully extended
>
> Then to runlevel 1 to make sure (almost) nothing is using the /var
> directory tree and
> root@wwwgw:~# lvextend -l+2G /dev/vgroup1/lvvar
> Extending logical volume lvvar to 3.86GiB
> Logical volume lvvar successfully resized
>
> root@wwwgw:~# umount /var
> Then first a filesystem check as that seems to be needed before resizing.
> Not doing so will give me a warning although this was not mentioned in the
> HOWTOs I have read. root@wwwgw:~# fsck -f /dev/vgroup1/lvvar
> root@wwwgw:~# resize2fs /dev/vgroup1/lvvar
> root@wwwgw:~# mount /var
>
> and back to runlevel 2
>
>
> Anything else I missed?
>
> Bonno Bloksma


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 201203161916.32502.miklcct@gmail.com">http://lists.debian.org/201203161916.32502.miklcct@gmail.com


All times are GMT. The time now is 10:49 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.