QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2060|回复: 0

Another LVM[12] How to

[复制链接]
发表于 2003-11-6 06:51:04 | 显示全部楼层 |阅读模式
This is not a step by step guide. Plese read the original LVM-Howto for detail. I
write this because there are some issues between LVM1 and LVM2, kernel 2.4 and 2.6. I
assume you know how to compile kernel and software, install rpm... What I want to show
here is how to install and use LVM1 under 2.4; install and use LVM2 under 2.6; and keep
them run well if you have both 2.4 and 2.6 kernel and you want to switch between them.

* Install RH9 as usual. After installation, check if lvm-xx.rpm is installed. Make sure
you have it. This is the LVM1 tools.

* Download, compile, and run kernel 2.4.22 (u can use existing redhat kernel if you want,
   but I like to use new 2.4.22 kernel, personal favour), enable the lvm(v1) support.
   
   OK, till now you have all lvm1 tools in /sbin, and you have kernel LVM1 support. I use
   two partitions on a scsi disk to show how to create pv, vg, and lv. and later i need to
   verify that i can use this lv under both kernels.
   
* Setup LVM1 (more detail in documentation/lvm-howto)
1. Set the partition system id to 0x8e on /dev/sda1 and /dev/sda2.

2. do a "pvcreate /dev/sda[12]"
   For testing purposes you can use more than one partition on a disk.
   You should not use more than one partition because in the case of
   a striped LV you'll have a performance breakdown. Here you need to do "vgscan"
   if required (system reports some error like /etc/lvmtab not found).

3. do a "vgcreate test_vg /dev/sda[12]" to create the new VG named "test_vg"
   which has the total capacity of both partitions.
   vgcreate activates (transfers the metadata into the LVM driver in the kernel)
   the new volume group too to be able to create LVs in the next step.

4. do a "lvcreate -L1500 -ntest_lv test_vg" to get a 1500MB linear LV named
   "test_lv" and it's block device special "/dev/test_vg/test_lv".

5. For example generate a filesystem in one LV with
   "mke2fs /dev/test_vg/test_lv" and mount it.

6. write some files on it for later verify.

* Upgrade to Linux 2.6.0-test9, choose device-mapper in kernel. upgrade module-init-tools as well.

* Download, compile, and install device-mapper userland lib and tools
        ftp://ftp.sistina.com/pub/LVM2/device-mapper/

* Download, compile, and install LVM2.
        ftp://ftp.sistina.com/pub/LVM2/tools
   !!! here you need to use "./configure --sbindir=/usr/sbin" instead of "./configure".
   If you do not do this, the lvm2 tools will be installed in /sbin as well, thus overwrite
   the lvm1 tools. of course, you can rename all lvm1 tools to xx1 like name if you really
   want to install the lvm2 tools to /sbin.
       
  when compile device-io.c, it may report BLKGETSIZE64 undeclared. Yes, this is
  because we use old /usr/include/linux/fs.h. One way is to wait and upgrade the
  glibc-kernheaders. But I simply add a "#ifndef BLKGETSIZE64
  #define BLKGETSIZE64 _IOR(0x12,114,size_t) #endif" in the .c file and
  it works. From the post http://lists.sistina.com/pipermail/linux-lvm/2003-July/014510.html,
  it saids to use kernel header files directly, I do not think this is a good idea.

* after "make install" in previous step, you get lvm2 tools installed. here you need to run
        "device-ampper-xx/scripts/devmap_mknod.sh". this is needed everytime. so put it in rc*
        to save some typing.
       
       
* do /usr/sbin/vgscan
* do /usr/sbin/vgchange -ay test_vg
* now you can mount /dev/test_vg/test_lv to somewhere to see the files you written in 2.4 kernel.
  write some files. reboot
* now back to 2.4 kernel. u should be able to see them as well.

!!! do not do vgconvert. it will convert vg to LVM2 format. then u can not use it under lvm1 anymore.
!!! you can install lvm2 in 2.4 kernel as well. see device-mapper INSTALL and README for detail.
        then u can use lvm2 under 2.4 kernel.
!!! have error, let me know.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-12-5 03:46 , Processed in 0.044199 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表