存档

‘Memo’ 分类的存档

将根分区安装到LVM2的一些笔记

2009年10月17日

最近换了块Intel的主板,据闻Intel芯片自带的Raid性能还可以,于是将我两个旧的西数160G硬盘组成了Raid0阵列,在上面装了个Gentoo和Windows7,也顺便用上了LVM2。
先说说我的分区情况,由于直接用主板自带的Raid控制器组成了Raid0,在Windows和Gentoo下被认成了一个320G的硬盘,可以直接在上面分区,无需用软件去组阵列。

/dev/sda1 == /boot , ext2
/dev/sda2 == Windows7 , ntfs
/dev/sda5 == LVM2

其中LVM2的分区情况是
/dev/mapper/gentoo-root == / , ext4
/dev/mapper/gentoo-home == /home , ext4
/dev/mapper/gentoo-usr == /usr , ext4
/dev/mapper/gentoo-var == /var , ext4
/dev/mapper/gentoo-swap == swap

/dev/sda6 == Data , ntfs

我用的是archlinux-2009.08-netinstall-x86_64.iso启动来分区和装Gentoo的,想要图形的LVM2界面可以用Fedora LiveCD。简要的记下安装的步骤

  • # modprobe dm-mod 加载模块
  • # vgchange -ay 启用已创建的LVM2卷组
  • # mkfs.ext4 /dev/mapper/* 格式化磁盘
  • # mount /dev/mapper/* /mnt/gentoo/* 挂载到相应的目录下
  • (中间的安装过程省略)
  • # genkernel –install –lvm2 –menuconfig –disklabel all 编译内核,那个lvm2参数好像已经是不推荐的了,但找不到其他方法,姑且用着吧(后面那些参数都是用两条横线分开的,WP很自作多情的把两条显示成一条了)
  • # emerge -q lvm2 && rc-update add lvm boot 安装用到的工具并设置启动运行
  • # vim /boot/grub/grub.conf 添加上dolvm udev两个参数,如下所示

    title Gentoo Linux 2.6.31-r2
    root (hd0,0)
    kernel /kernel-genkernel-x86_64-2.6.31-gentoo-r2 udev dolvm root=/dev/ram0 real_root=/dev/mapper/gentoo-root
    initrd /initramfs-genkernel-x86_64-2.6.31-gentoo-r2

  • # grub-install –no-floppy /dev/sda 安装Grub到MBR上

大功告成,可以重启进Gentoo里了。

参考资料:

Memo ,

备忘:使用TuxOnIce内核 之一

2009年2月19日

TuxOnIce内核是什么?下面是官方的说明

TuxOnIce is most easily described as the Linux equivalent of Windows’ hibernate functionality. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off. No documents need to be reloaded or applications reopened and the process is much faster than a normal shutdown and start up.

而我最喜欢TuxOnIce内核的休眠到硬盘的功能了(又称STD,Suspend to Disk),用过Windows休眠功能的应该有所体会,而且还支持FBSplash。

以下是一段官方的从休眠到再启动的视频,长度1分22秒。

从视频中可以看到,从休眠到重新启动计算机所花的时间也就1分20秒左右,对于Fedora来说速度还算快的。下面介绍如何在Archlinux和Gentoo上安装TuxOnIce内核

Archlinux
AUR上就有,名字是kernel26-ice,可以很方便的 yaourt 到。推荐修改 PKGBUILD 文件,反注释掉 make menuconfig 这行,否则会编译出一个臃肿的内核。具体的方法可以浏览《在Archlinux下编译TuxOnIce内核》这篇文章。

Gentoo
首先 emerge TuxOnIce内核的源码

emerge tuxonice-sources

如果需要用到 FBSplash 的还需要为 sys-apps/tuxonice-userui 打开 fbsplash 这个 USE

echo “sys-apps/tuxonice-userui fbsplash” >> /etc/portage/package.use

然后修改 /usr/src/linux 的符号链接可以用下面的方法修改

eselect kernel list
eselect kernel set 3 #这里填 TuxOnIce 所在的那行

然后就是 make 了,是不是很简单 :)

Memo , ,