Tampilkan postingan dengan label lvm. Tampilkan semua postingan
Tampilkan postingan dengan label lvm. Tampilkan semua postingan

Rabu, 30 September 2009

LVM Disk Recipes for Debian

After much wrangling and researching I finally figured out how to get LVM disk recipes to work with Debian preseeding. The following recipe will create a partition layout of what's in the table. When making these recipes make sure that you account for extra whitespace that may be hiding (especially spaces) otherwise it may yield unexpected results.


Mount PointTypeVGLV NameSize (MB)Filesystem
/bootPrimary100ext3
/LVMvg00/dev/vg00/rootvol4096ext3
/varLVMvg00/dev/vg00/varvol1024ext3
swapLVMvg00/dev/vg00/swapvol2048swap
/homeLVMvg00/dev/vg00/homevolremaining spaceext3


Recipe file:



Ubuntu/Debian Custom LVM Disk Recipe ::

100 1000 100 ext3
$primary{ }
$bootable{ }
device{ /dev/sda }
method{ format }
format{ }
use_filesystem{ }
filesystem{ ext3 }
mountpoint{ /boot }
.

100 100000 -1 lvm
$primary{ } $defaultignore{ }
method{ lvm } vg_name{ vg00 }
.

4096 10000 4096 ext3
$lvmok{ } in_vg{ vg00 } lv_name{ rootvol }
method{ format } format{ }
use_filesystem{ } filesystem{ ext3 }
mountpoint{ / }
.

1024 4000 1024 ext3
$lvmok{ } in_vg{ vg00 } lv_name{ varvol }
method{ format } format{ }
use_filesystem{ } filesystem{ ext3 }
mountpoint{ /var }
.

2048 5000 2048 linux-swap
$lvmok{ } in_vg{ vg00 } lv_name{ swapvol }
method{ swap } format{ }
.

1024 1000000 -1 ext3
$lvmok{ } in_vg{ vg00 } lv_name{ homevol }
method{ format } format{ }
use_filesystem{ } filesystem{ ext3 }
mountpoint{ /home }
.

Selasa, 20 Januari 2009

Add extra storage on the fly with LVM2

Currently I am in the process of creating a file/print server for my home network. It's an older computer but I wanted to experiment with various set-ups and configurations. Two of my requirements were that I must be able to add extra storage on the fly and I must be able to see the two hard drives as one logical unit. The only way (at least that I know of) is to use LVM. I have used it in the past, but I never really needed so I usually did not pick it during the install. In fact my current Ubuntu desktop does not have LVM on it.

During my internet searches I came across this great article, A Beginners Guide to LVM. Read this all the way through and you should get a good grasp of the main commands of LVM. Since that article did not really explain how to what I wanted I had to adapt it to my needs. Here are the steps I used to get my 80GB Maxtor(sda) and 60GB Western Digital(sdb) to work together as one logical unit. I am also using ext3 as my filesystem because it supports on-line resizing.
  1. Fresh install of Ubuntu Server 8.10
  2. Run updates:
    sudo aptitude update && sudo aptitude safe-upgrade
  3. Reboot because of kernel upgrade
  4. Figure out what the extra hard drive is (mine is sdb):
    sudo fdisk -l
  5. Partition the hard drive as Linux LVM:
    sudo fdisk /dev/sdb
  6. Initialize partition for use by LVM (on my system sdb1 is swap):
    sudo pvcreate /dev/sdb2
  7. Display attributes of volume groups to find your group name (mine is ubuntu-server):
    sudo vgdisplay
  8. Add my physical volume to my volume group:
    sudo vgextend ubuntu-server /dev/sdb2
  9. Now extend the logical volume root to include the new physical volume:
    sudo lvextend -L128G /dev/ubuntu-server/root
  10. Lastly, resize the filesystem to include the new free space:
    sudo resize2fs /dev/ubuntu-server/root
After reading the beginners guide posted above I was able to go through these steps and add extra storage without unmounting the root parition. This is one of the features of ext3, but I do not know whether you can do that with other filesystems. Now I am able to use both drives to the fullest extent and when I want to add another drive it will be quite easy.
 
support by: infomediaku.com