LVM安装ArchLinux
最近一直没有在自己的机器上折腾linux了,这次准备在ArchLinux上使用LVM以前一直没有使用过,具体可以参考archlinux wiki(http://wiki.archlinux.org/index.php/LVM_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29)。我做了一些总结。
# modprobe dm-mod # vgchange -ay
上面的命令必须要运行
设置好LVM,创建分区,逻辑卷,我这里没有把boot分出来,然后运行安装程序。
重要
- (Set Filesystem Mountpoints)当选择挂载点时(除了/boot),千万不要选择实际存在的逻辑卷(比如:/dev/sda2),只需选择由lv创建的逻辑卷(比如: /dev/mapper/Volgroup00-lvolhome)。
- (Configure System)在 /etc/rc.conf 中,把USELVM="no" 修改成 USELVM="yes"
- (Configure System)Make sure that lvm2 is in the HOOKS section of /etc/mkinitcpio.conf just before the filesystems so that your kernel will find LVM volumes at boot time.
参照一般的安装方法好,最后不要安装bootloader。
由于我连boot分区都在LVM上,所以必须安装grub2,这个时候必须chroot
# mount -t proc none /mnt/proc # mount -o bind /dev /mnt/dev # pacman -Sy # pacman -S grub2 # grub-install /dev/sda
最后编辑/boot/grub/grub.cfg
insmod lvm
# Timeout for menu
set timeout=5
# Set default boot entry as Entry 0
set default=0
# (0) Arch Linux
menuentry "Arch Linux" {
set root=(VolGroup00-lvolboot)
linux /vmlinuz26 root=/dev/mapper/VolGroup00-lvolroot ro
initrd /kernel26.img
}
基本上这就安装好了。虚拟机一样适用。
enjoy it!