LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Query about the LVM? (https://www.linuxquestions.org/questions/linux-newbie-8/query-about-the-lvm-791727/)

your_shadow03 02-26-2010 07:35 AM

Query about the LVM?
 
My Fedora 11 hard disk space setup is
Code:

[root@localhost ~]# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000001

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1        1275    10241406    7  HPFS/NTFS
/dev/sda2            1276      30401  233954595    f  W95 Ext'd (LBA)
/dev/sda5            1276        5099    30716248+  7  HPFS/NTFS
/dev/sda6            5100      11473    51199123+  7  HPFS/NTFS
/dev/sda7          11474      17847    51199123+  7  HPFS/NTFS
/dev/sda8  *      17848      17873      204799+  83  Linux
/dev/sda9          17873      30401  100635204  8e  Linux LVM

Disk /dev/dm-0: 98.8 GB, 98838773760 bytes
255 heads, 63 sectors/track, 12016 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 4211 MB, 4211081216 bytes
255 heads, 63 sectors/track, 511 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table
[root@localhost ~]#

Code:

root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name              /dev/sda9
  VG Name              VolGroup
  PV Size              95.97 GB / not usable 580.00 KB
  Allocatable          yes (but full)
  PE Size (KByte)      4096
  Total PE              24569
  Free PE              0
  Allocated PE          24569
  PV UUID              qLL0E0-dSrG-Uw2P-Q3Hi-yMUx-3qtv-VUZQAf
 
[root@localhost ~]# ^C
[root@localhost ~]#

Code:

[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name              VolGroup
  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              95.97 GB
  PE Size              4.00 MB
  Total PE              24569
  Alloc PE / Size      24569 / 95.97 GB
  Free  PE / Size      0 / 0 
  VG UUID              MxbEko-QoTK-ObyY-cwF1-8Fzf-cvat-SwNccQ
 
[root@localhost ~]#

Code:

[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_root
  VG Name                VolGroup
  LV UUID                LSScW6-oe33-fvR0-4hhM-MFHb-Pjv2-ewkeFX
  LV Write Access        read/write
  LV Status              available
  # open                1
  LV Size                92.05 GB
  Current LE            23565
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          253:0
 
  --- Logical volume ---
  LV Name                /dev/VolGroup/lv_swap
  VG Name                VolGroup
  LV UUID                3SUYIk-9juP-ARsq-RATf-f6PO-Us45-15f5pU
  LV Write Access        read/write
  LV Status              available
  # open                1
  LV Size                3.92 GB
  Current LE            1004
  Segments              1
  Allocation            inherit
  Read ahead sectors    auto
  - currently set to    256
  Block device          253:1
 
[root@localhost ~]#

The Linux was installed through automatic partition option.

Few doubts to ask:
1. What partitions are recommended to be created on LVM?
Is boot and swap partition recommended?

2.What more partition I can create with this LVM?

Simon Bridge 02-26-2010 07:49 AM

These days you can put what you like on LVM.
Used to be you couldn't put /boot on it.
Read up about it to make sure you want what it does.
It's often used like RAID - only more flexible.

your_shadow03 02-26-2010 07:53 AM

Any specific reason for not putting /boot.
As I think if it put could save our life more.

GazL 02-26-2010 08:01 AM

Quote:

Originally Posted by Simon Bridge (Post 3877754)
These days you can put what you like on LVM.
Used to be you couldn't put /boot on it.

You still can't if you use luks encrypted PVs, but that's a special case.


Simon is correct: create whatever lv's you feel like. Partitioning is a very personal choice.

Here's mine. I'm sure you can guess where they're mounted based on the lv names. :)
Code:

root@nix:~# pvs
  PV                VG    Fmt  Attr PSize  PFree 
  /dev/mapper/pvsda5 rootvg lvm2 a-  306.41G 184.91G
root@nix:~# lvs
  LV      VG    Attr  LSize  Origin Snap%  Move Log Copy%  Convert
  lvhome  rootvg -wi-ao  8.00G                                     
  lvlocal rootvg -wi-ao  80.00G                                     
  lvopt  rootvg -wi-ao 512.00M                                     
  lvroot  rootvg -wi-ao 512.00M                                     
  lvtmp  rootvg -wi-ao 512.00M                                     
  lvusr  rootvg -wi-ao  16.00G                                     
  lvvar  rootvg -wi-ao  16.00G                                     
root@nix:~#

I have enough free ram not to need swap, but should I ever need it, I'll add a lvswap to the collection.


P.S. Some people prefer to keep / (rootfs) and /boot outside of lvm to help with resilience and to ensure that you can still boot the system to a maintenance shell if your lvm config gets corrupted somehow. Personally, I don't subscribe to this and I keep a live-cd to hand to boot from should I ever end up in that situation.

Simon Bridge 02-26-2010 09:05 AM

/boot is where the kernel lives... and the kernel contains the drivers which can manage the lvm volume. Thus, it used to be a bit like opening a box with the key locked inside it. These days, the ability has been added to grub.

If you use encryption, you still have the issue that something must be unencrypted to load the keys. ince /boot is not writable in normal operation, it is safe to leave unencrypted. Unlike windows which can write sensitive data anywhere and so needs whole-disk encryption.

It is not too uncommon in linux to put /boot on a keydrive though - so it will only boot with the key in the lock as it were. The internal drive can be totally encrypted then.


Note on swap: if you want to use hibernate - you need swap.
If you have lots of RAM, you can get away with lowering swappiness.


All times are GMT -5. The time now is 08:29 PM.