LVM partitions partitions and swap

General support questions
Post Reply
Jamesarthur26
Posts: 1
Joined: 2018/06/16 09:06:29

LVM partitions partitions and swap

Post by Jamesarthur26 » 2018/06/16 09:09:27

My partitions layout for server is:
/dev/sda1 partition, 512 MB, type Linux 83 (/boot)
/dev/sda2 partition, 60 GB, type: LVM 8e

/dev/mapper/vg_centos is the volume group which has /dev/sda2 physical volume

I think my partitions layout is best way to create LVM, what do you think?
It's best way to define swap partition into LVM or it's better to define it as Linux 83 type (outside lvm)?

User avatar
TrevorH
Forum Moderator
Posts: 23196
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: LVM partitions partitions and swap

Post by TrevorH » 2018/06/16 11:53:38

I don't really see the point of using a plain partition for swap if everything else uses LVM. Might as well make it all LVM as it's more flexible. For example, with freespace left in the VG you can lvextend a swap LV on the fly (though you have to swapoff/mkswap/swapon to make it take effect). With a partition you would have to swapoff/fdisk/reboot/swapon and also remember to edit /etc/fstab to disable swap for the reboot or deal with emergency mode instead!).

I would ask why you're using CentOS 6 for what appears to be a new install though. It's already gone into what's known as Production Phase 3 where only critical security bugs are fixed and has about 2 years of life left in it before it goes EOL entirely. For a new install, I'd use CentOS 7 which is the current and latest version.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply