linux + how to convert VMDK disk to LVM disk

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












we have linux machine
with sdb disk



 lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 150G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 149.5G 0 part
├─lp55-lv_root 253:0 0 40G 0 lvm /
├─lp55-lv_swap 253:1 0 7.7G 0 lvm [SWAP]
└─lp55-lv_var 253:2 0 100.9G 0 lvm /var
sdb 8:16 0 100G 0 disk


for now sdb isnt LVM



we want to create the sdb to LVM with new VG group as new1
so we can increase the sdb as we want later



what is the procedure to convert sdb to LVM



# pvs
# lvdisplay
No volume groups found
# pvdisplay
# vgdisplay
No volume groups found
#

rpm -qa | grep -i lvm
lvm2-2.02.100-8.el6.x86_64
lvm2-libs-2.02.100-8.el6.x86_64









share|improve this question























  • Do you need to save any data on sdb or can it be wiped?
    – Stephen Harris
    7 hours ago










  • wiped - like a new disk
    – yael
    7 hours ago














up vote
1
down vote

favorite












we have linux machine
with sdb disk



 lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 150G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 149.5G 0 part
├─lp55-lv_root 253:0 0 40G 0 lvm /
├─lp55-lv_swap 253:1 0 7.7G 0 lvm [SWAP]
└─lp55-lv_var 253:2 0 100.9G 0 lvm /var
sdb 8:16 0 100G 0 disk


for now sdb isnt LVM



we want to create the sdb to LVM with new VG group as new1
so we can increase the sdb as we want later



what is the procedure to convert sdb to LVM



# pvs
# lvdisplay
No volume groups found
# pvdisplay
# vgdisplay
No volume groups found
#

rpm -qa | grep -i lvm
lvm2-2.02.100-8.el6.x86_64
lvm2-libs-2.02.100-8.el6.x86_64









share|improve this question























  • Do you need to save any data on sdb or can it be wiped?
    – Stephen Harris
    7 hours ago










  • wiped - like a new disk
    – yael
    7 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











we have linux machine
with sdb disk



 lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 150G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 149.5G 0 part
├─lp55-lv_root 253:0 0 40G 0 lvm /
├─lp55-lv_swap 253:1 0 7.7G 0 lvm [SWAP]
└─lp55-lv_var 253:2 0 100.9G 0 lvm /var
sdb 8:16 0 100G 0 disk


for now sdb isnt LVM



we want to create the sdb to LVM with new VG group as new1
so we can increase the sdb as we want later



what is the procedure to convert sdb to LVM



# pvs
# lvdisplay
No volume groups found
# pvdisplay
# vgdisplay
No volume groups found
#

rpm -qa | grep -i lvm
lvm2-2.02.100-8.el6.x86_64
lvm2-libs-2.02.100-8.el6.x86_64









share|improve this question















we have linux machine
with sdb disk



 lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 150G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 149.5G 0 part
├─lp55-lv_root 253:0 0 40G 0 lvm /
├─lp55-lv_swap 253:1 0 7.7G 0 lvm [SWAP]
└─lp55-lv_var 253:2 0 100.9G 0 lvm /var
sdb 8:16 0 100G 0 disk


for now sdb isnt LVM



we want to create the sdb to LVM with new VG group as new1
so we can increase the sdb as we want later



what is the procedure to convert sdb to LVM



# pvs
# lvdisplay
No volume groups found
# pvdisplay
# vgdisplay
No volume groups found
#

rpm -qa | grep -i lvm
lvm2-2.02.100-8.el6.x86_64
lvm2-libs-2.02.100-8.el6.x86_64






linux rhel lvm vmware






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 hours ago

























asked 7 hours ago









yael

2,1851650




2,1851650











  • Do you need to save any data on sdb or can it be wiped?
    – Stephen Harris
    7 hours ago










  • wiped - like a new disk
    – yael
    7 hours ago
















  • Do you need to save any data on sdb or can it be wiped?
    – Stephen Harris
    7 hours ago










  • wiped - like a new disk
    – yael
    7 hours ago















Do you need to save any data on sdb or can it be wiped?
– Stephen Harris
7 hours ago




Do you need to save any data on sdb or can it be wiped?
– Stephen Harris
7 hours ago












wiped - like a new disk
– yael
7 hours ago




wiped - like a new disk
– yael
7 hours ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










You could partition the /dev/sdb to make it recognizable to other operating systems that the disk is in use, but that will make extending the disk more complicated in the future, and since it's a VMDK its name on the virtualization host should make its purpose obvious anyway. So I'd recommend omitting the partitioning in this case, and just using the whole virtual disk for the LVM. So:



pvcreate /dev/sdb


Then you could just extend your existing VG with the new PV (with vgextend lp55 /dev/sdb), but as you said you want to create a new VG, so:



vgcreate new1 /dev/sdb


At this point, the new VG is created but has no LVs allocated. If you want to use all the available capacity into a single LV/filesystem, then you could do this:



lvcreate -n lv_name -l 100%FREE new1


If you want to create a LV of some specific size, you can use -L nnnG to specify the size in GiB instead of -l 100%FREE.



(You probably should replace lv_name with something that describes the intended use of the LV.)



After the LV is created, you are free to use it as you wish. You may put a filesystem (of whatever type) onto it and mount it, or use it as a raw storage for a database engine, or whatever you want to do with it.



For example, to create an ext4 filesystem on it:



mkfs.ext4 /dev/new1/lv_name


Then, create a mountpoint wherever is appropriate to you:



mkdir /some/where


Create an entry in /etc/fstab:



/dev/new1/lv_name /some/where ext4 defaults 0 2


And mount it:



mount /some/where


and you're done.






share|improve this answer






















  • what about ext4 filesystem
    – yael
    7 hours ago










  • can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
    – yael
    5 hours ago

















up vote
1
down vote













Since you don't need to save any data you can following the standard process:



pvcreate /dev/sdb
vgcreate new1 /dev/sdb


And now you can lvcreate volumes on that VG



lvcreate -L10G -n testvol1 new1


If you increase the size of sdb afterwards, you can use the pvresize to make the new space available.






share|improve this answer




















  • what about ext4 filesystem
    – yael
    7 hours ago










  • Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
    – Stephen Harris
    6 hours ago










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479741%2flinux-how-to-convert-vmdk-disk-to-lvm-disk%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










You could partition the /dev/sdb to make it recognizable to other operating systems that the disk is in use, but that will make extending the disk more complicated in the future, and since it's a VMDK its name on the virtualization host should make its purpose obvious anyway. So I'd recommend omitting the partitioning in this case, and just using the whole virtual disk for the LVM. So:



pvcreate /dev/sdb


Then you could just extend your existing VG with the new PV (with vgextend lp55 /dev/sdb), but as you said you want to create a new VG, so:



vgcreate new1 /dev/sdb


At this point, the new VG is created but has no LVs allocated. If you want to use all the available capacity into a single LV/filesystem, then you could do this:



lvcreate -n lv_name -l 100%FREE new1


If you want to create a LV of some specific size, you can use -L nnnG to specify the size in GiB instead of -l 100%FREE.



(You probably should replace lv_name with something that describes the intended use of the LV.)



After the LV is created, you are free to use it as you wish. You may put a filesystem (of whatever type) onto it and mount it, or use it as a raw storage for a database engine, or whatever you want to do with it.



For example, to create an ext4 filesystem on it:



mkfs.ext4 /dev/new1/lv_name


Then, create a mountpoint wherever is appropriate to you:



mkdir /some/where


Create an entry in /etc/fstab:



/dev/new1/lv_name /some/where ext4 defaults 0 2


And mount it:



mount /some/where


and you're done.






share|improve this answer






















  • what about ext4 filesystem
    – yael
    7 hours ago










  • can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
    – yael
    5 hours ago














up vote
3
down vote



accepted










You could partition the /dev/sdb to make it recognizable to other operating systems that the disk is in use, but that will make extending the disk more complicated in the future, and since it's a VMDK its name on the virtualization host should make its purpose obvious anyway. So I'd recommend omitting the partitioning in this case, and just using the whole virtual disk for the LVM. So:



pvcreate /dev/sdb


Then you could just extend your existing VG with the new PV (with vgextend lp55 /dev/sdb), but as you said you want to create a new VG, so:



vgcreate new1 /dev/sdb


At this point, the new VG is created but has no LVs allocated. If you want to use all the available capacity into a single LV/filesystem, then you could do this:



lvcreate -n lv_name -l 100%FREE new1


If you want to create a LV of some specific size, you can use -L nnnG to specify the size in GiB instead of -l 100%FREE.



(You probably should replace lv_name with something that describes the intended use of the LV.)



After the LV is created, you are free to use it as you wish. You may put a filesystem (of whatever type) onto it and mount it, or use it as a raw storage for a database engine, or whatever you want to do with it.



For example, to create an ext4 filesystem on it:



mkfs.ext4 /dev/new1/lv_name


Then, create a mountpoint wherever is appropriate to you:



mkdir /some/where


Create an entry in /etc/fstab:



/dev/new1/lv_name /some/where ext4 defaults 0 2


And mount it:



mount /some/where


and you're done.






share|improve this answer






















  • what about ext4 filesystem
    – yael
    7 hours ago










  • can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
    – yael
    5 hours ago












up vote
3
down vote



accepted







up vote
3
down vote



accepted






You could partition the /dev/sdb to make it recognizable to other operating systems that the disk is in use, but that will make extending the disk more complicated in the future, and since it's a VMDK its name on the virtualization host should make its purpose obvious anyway. So I'd recommend omitting the partitioning in this case, and just using the whole virtual disk for the LVM. So:



pvcreate /dev/sdb


Then you could just extend your existing VG with the new PV (with vgextend lp55 /dev/sdb), but as you said you want to create a new VG, so:



vgcreate new1 /dev/sdb


At this point, the new VG is created but has no LVs allocated. If you want to use all the available capacity into a single LV/filesystem, then you could do this:



lvcreate -n lv_name -l 100%FREE new1


If you want to create a LV of some specific size, you can use -L nnnG to specify the size in GiB instead of -l 100%FREE.



(You probably should replace lv_name with something that describes the intended use of the LV.)



After the LV is created, you are free to use it as you wish. You may put a filesystem (of whatever type) onto it and mount it, or use it as a raw storage for a database engine, or whatever you want to do with it.



For example, to create an ext4 filesystem on it:



mkfs.ext4 /dev/new1/lv_name


Then, create a mountpoint wherever is appropriate to you:



mkdir /some/where


Create an entry in /etc/fstab:



/dev/new1/lv_name /some/where ext4 defaults 0 2


And mount it:



mount /some/where


and you're done.






share|improve this answer














You could partition the /dev/sdb to make it recognizable to other operating systems that the disk is in use, but that will make extending the disk more complicated in the future, and since it's a VMDK its name on the virtualization host should make its purpose obvious anyway. So I'd recommend omitting the partitioning in this case, and just using the whole virtual disk for the LVM. So:



pvcreate /dev/sdb


Then you could just extend your existing VG with the new PV (with vgextend lp55 /dev/sdb), but as you said you want to create a new VG, so:



vgcreate new1 /dev/sdb


At this point, the new VG is created but has no LVs allocated. If you want to use all the available capacity into a single LV/filesystem, then you could do this:



lvcreate -n lv_name -l 100%FREE new1


If you want to create a LV of some specific size, you can use -L nnnG to specify the size in GiB instead of -l 100%FREE.



(You probably should replace lv_name with something that describes the intended use of the LV.)



After the LV is created, you are free to use it as you wish. You may put a filesystem (of whatever type) onto it and mount it, or use it as a raw storage for a database engine, or whatever you want to do with it.



For example, to create an ext4 filesystem on it:



mkfs.ext4 /dev/new1/lv_name


Then, create a mountpoint wherever is appropriate to you:



mkdir /some/where


Create an entry in /etc/fstab:



/dev/new1/lv_name /some/where ext4 defaults 0 2


And mount it:



mount /some/where


and you're done.







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 7 hours ago









telcoM

13.8k11842




13.8k11842











  • what about ext4 filesystem
    – yael
    7 hours ago










  • can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
    – yael
    5 hours ago
















  • what about ext4 filesystem
    – yael
    7 hours ago










  • can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
    – yael
    5 hours ago















what about ext4 filesystem
– yael
7 hours ago




what about ext4 filesystem
– yael
7 hours ago












can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
– yael
5 hours ago




can we use - mkfs.xfs /dev/new1/lv_name ( insted mkfs.ext4 ) ?
– yael
5 hours ago












up vote
1
down vote













Since you don't need to save any data you can following the standard process:



pvcreate /dev/sdb
vgcreate new1 /dev/sdb


And now you can lvcreate volumes on that VG



lvcreate -L10G -n testvol1 new1


If you increase the size of sdb afterwards, you can use the pvresize to make the new space available.






share|improve this answer




















  • what about ext4 filesystem
    – yael
    7 hours ago










  • Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
    – Stephen Harris
    6 hours ago














up vote
1
down vote













Since you don't need to save any data you can following the standard process:



pvcreate /dev/sdb
vgcreate new1 /dev/sdb


And now you can lvcreate volumes on that VG



lvcreate -L10G -n testvol1 new1


If you increase the size of sdb afterwards, you can use the pvresize to make the new space available.






share|improve this answer




















  • what about ext4 filesystem
    – yael
    7 hours ago










  • Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
    – Stephen Harris
    6 hours ago












up vote
1
down vote










up vote
1
down vote









Since you don't need to save any data you can following the standard process:



pvcreate /dev/sdb
vgcreate new1 /dev/sdb


And now you can lvcreate volumes on that VG



lvcreate -L10G -n testvol1 new1


If you increase the size of sdb afterwards, you can use the pvresize to make the new space available.






share|improve this answer












Since you don't need to save any data you can following the standard process:



pvcreate /dev/sdb
vgcreate new1 /dev/sdb


And now you can lvcreate volumes on that VG



lvcreate -L10G -n testvol1 new1


If you increase the size of sdb afterwards, you can use the pvresize to make the new space available.







share|improve this answer












share|improve this answer



share|improve this answer










answered 7 hours ago









Stephen Harris

22.6k24076




22.6k24076











  • what about ext4 filesystem
    – yael
    7 hours ago










  • Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
    – Stephen Harris
    6 hours ago
















  • what about ext4 filesystem
    – yael
    7 hours ago










  • Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
    – Stephen Harris
    6 hours ago















what about ext4 filesystem
– yael
7 hours ago




what about ext4 filesystem
– yael
7 hours ago












Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
– Stephen Harris
6 hours ago




Once you've created the LV, you can mke2fs on it, same as any other partition or volume (eg mke2fs -t ext4 /dev/new1/testvol1)
– Stephen Harris
6 hours ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479741%2flinux-how-to-convert-vmdk-disk-to-lvm-disk%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke