First of all, my BIG thanks to the research program I signed up as a test subject, and to all who gave me support during the period - my bosses, my colleagues, and especially my wife :)
I have been trying to reduce my weight for years, but I have not made much progress towards my goal. I once thought it is difficult for me because somehow I digest food very fast and when I need energy, my body cannot convert fat to energy efficiently. After this program, I realized I was all wrong... I now know that I cannot reduce my weight because I ate too much, and exercise too little :P
There is no secret in losing weight. Basically, you have to ensure your calories intake is less than your output. In my case,
1) I take 500 less calories than my usual intake amount of 2000 to 2200. Which means, I take 1500 - 1700 calories per day during the weight loss phase.
How to control the intake precisely is the tricky part. Either you can measure the calories of the food you eat one by one, or you can take some meal replacement like me (as required by my program). There are plenty of brands out there and I will not mention any specific ones because I am not advertising here.
I take meal replacement for 2 meals, 5 days a week. For the rest of the meals I eat my normal amount (which should not be over-sized - just moderate amount).
In between my meals, I take 2 times snacks, one in the morning and the other in the afternoon. Each snack should be less than 100 calories and should be something difficult to digest (e.g. no soft drinks :P). I will sometimes take max 2 servings of fruits per day. Again, choose difficult to digest fruits.
If you have issue with getting hungry too soon, you can try meal replacements with protein powders. In my case the meal replacement worked pretty well in hunger control.
Of course it is not a hard and fast rule that you must reduce 500 calories intake per day. The basic idea is to eat less for main meals, and fill the gap with snacks. Overall you should eat a few hundred calories less than what you ought to (again usually it is 2000-2200 for male adults. Not sure about ladies...)
2) I do gym exercises to burn fats 3 times a week. Each session burns 500 calories. So that's a total of 1500 calories per week.
What I usually do for the gym sessions is fast walking (around 14 incline, 5.5 km/h) on treadmill, which takes me about 40 to 50 minutes to burn 500 calories. Other exercises like cross trainer are equally fine, as long as you don't do something too intense. The key thing here in my opinion is sustainability - you have to ensure your body can take it and won't get pain or too tired after the session.
Again, it is not a rule that one must consume 500 calories per session, and must do 3 sessions per week. However, the total amount burnt cannot be too little, I guess.
3) This is important, you must be disciplined to do 1) and 2). Do not skip them unless you are really sick... In my case, I found it not difficult (not easy either, of course) to do all those for 4 months.
The result - I lost 12 kg and 5.3 inches of waist. I must say it is pretty awesome :P
That's all - no magical pills, no slimming sessions on expensive equipment. No adverse side effects (except that I felt a bit hungry sometimes). It is a natural and effective way of losing weight. Hope it helps for those who are in a similar situation like me.
Saturday, January 26, 2013
Monday, November 28, 2011
New PC Components
New Stuff:
Motherboard: ASRock Z68 Extreme4 Gen3
CPU: Intel Core i5 2500K
SGD 583
RAM: Corsair Vengeance DDR3-1600 4GB X 2
SGD 85
Primary Disk: ADATA S511 120GB
SGD 290
Motherboard: ASRock Z68 Extreme4 Gen3
CPU: Intel Core i5 2500K
SGD 583
RAM: Corsair Vengeance DDR3-1600 4GB X 2
SGD 85
Primary Disk: ADATA S511 120GB
SGD 290
Monday, June 13, 2011
Consequences of Treating My Car as Amphibious
I have to admit - driving my car through floods in Bukit Timah Road is thrilling and fun... but the consequence is dire :P (Well, it could be much worse, if the water went into the engine.)
Just recording down the damage for reference later based on my interpretation of the repair bill.
1) The ETM (Electronic Throttle Module) obviously has to be cleaned because water got into it. Luckily, labor cost only - SGD 169. (http://www.youtube.com/watch?v=8Zaxtm-hdyo)
2) MAF (Mass Air Flow) Sensor has to be replaced. This one damn expensive - SGD 728 for parts and 65 for labor.
3) Air Filter has to be replaced because water got in. Cheap.
4) Spark Plug has to be replaced too. about 200 parts + labor.
5) Intercooler is ok, but need to be removed and reinstalled to replace other parts I think. SGD 327.
Good thing is, the clutch-in seems more smooth after the repair... Anyway, next time, detour whenever seeing flood :)
Just recording down the damage for reference later based on my interpretation of the repair bill.
1) The ETM (Electronic Throttle Module) obviously has to be cleaned because water got into it. Luckily, labor cost only - SGD 169. (http://www.youtube.com/watch?v=8Zaxtm-hdyo)
2) MAF (Mass Air Flow) Sensor has to be replaced. This one damn expensive - SGD 728 for parts and 65 for labor.
3) Air Filter has to be replaced because water got in. Cheap.
4) Spark Plug has to be replaced too. about 200 parts + labor.
5) Intercooler is ok, but need to be removed and reinstalled to replace other parts I think. SGD 327.
Good thing is, the clutch-in seems more smooth after the repair... Anyway, next time, detour whenever seeing flood :)
Wednesday, June 1, 2011
How I fixed my MSI P35 Neo2 FR's problem
I am using a 3 year old MSI P35 Neo2 FR (MSI 7345) motherboard with 4 sticks of 1GB Corsair XMS DDR2-800 RAM. The 7345 started to have problem when all 4 sticks are inserted - I can't remember since when the problem started to surface.
Symptoms include - system hang at "Initializing USB Controller..." during boot-up; IO error after boot loader phase; hanging at Windows start up screen (or during Linux boot-up, showing some ata device IO errors); RAM error during boot-up check (as shown by on-board diagnostic LEDs); disk IO errors after booting into Windows, etc.
The problems seem unpredicatable, and I have spent a lot of time troubleshooting these problems. I went for RMA and replaced my motherboard eventually, but the problems still persist.
In the end, I discovered that once I turn off the Quick Booting option in BIOS, the problems seem gone. Still need to monitor for a bit longer to make sure it is indeed the solution.
And, I shall never buy another MSI board for my next PC.
Symptoms include - system hang at "Initializing USB Controller..." during boot-up; IO error after boot loader phase; hanging at Windows start up screen (or during Linux boot-up, showing some ata device IO errors); RAM error during boot-up check (as shown by on-board diagnostic LEDs); disk IO errors after booting into Windows, etc.
The problems seem unpredicatable, and I have spent a lot of time troubleshooting these problems. I went for RMA and replaced my motherboard eventually, but the problems still persist.
In the end, I discovered that once I turn off the Quick Booting option in BIOS, the problems seem gone. Still need to monitor for a bit longer to make sure it is indeed the solution.
And, I shall never buy another MSI board for my next PC.
Sunday, August 29, 2010
HDD partition plan
Intel X25M
sda1 - Windows 7 and WoW
320GB HDD1
sdb1 (30G) - Windows 7 User directory
sdb2 (30G) - Games
sdb5 (80G) - Linux LVM/RAID1 - don't touch
sdb6 (40G) - To convert into NTFS
sdb7 (10G) - RAID volume for Slackware root partition - don't touch
sdb8 (10G) - RAID volume for Ubuntu root partition - keep for now
sdb9 (120G) - Media
320GB HDD2
sdc1 (60G) - Data
sdc5/6/7/8 - same as sdb5-8
sdc9 (120G) - Backup
sda1 - Windows 7 and WoW
320GB HDD1
sdb1 (30G) - Windows 7 User directory
sdb2 (30G) - Games
sdb5 (80G) - Linux LVM/RAID1 - don't touch
sdb6 (40G) - To convert into NTFS
sdb7 (10G) - RAID volume for Slackware root partition - don't touch
sdb8 (10G) - RAID volume for Ubuntu root partition - keep for now
sdb9 (120G) - Media
320GB HDD2
sdc1 (60G) - Data
sdc5/6/7/8 - same as sdb5-8
sdc9 (120G) - Backup
Sunday, March 28, 2010
Wednesday, November 12, 2008
Removing a RAID partition
To remove a RAID device that consists of 2 partitions (sda7 and sdb7) that has an LVM2 VG on top:
- lvremove to remove all LVs
- vgremove to remove all VGs
- pvremove to remove all PVs
- mdadm --stop to stop the device
- mdadm --remove to remove the device
- mdadm --zero-superblock to erase the md superblock on each of the 2 partitions
- update /etc/mdadm.conf to remove the md device
- lvremove to remove all LVs
- vgremove to remove all VGs
- pvremove to remove all PVs
- mdadm --stop to stop the device
- mdadm --remove to remove the device
- mdadm --zero-superblock to erase the md superblock on each of the 2 partitions
- update /etc/mdadm.conf to remove the md device
Migrating /tmp to another partition
I decided to remove the 80G RAID-0 partition in my PC, and migrate the data inside to other LVM partitions. Currently, the partition has 1 LVM2 vg which contains 3 lvs. One of them contains files I downloaded and the other 2 are /tmp filesystems in my Slackware and Ubuntu installations respectively. I simply copied the files in the first lv to another lv (non-RAID LVM). For /tmp filesystems, I did the following steps for each of them:
- Create a new lv (RAID-1 LVM) of 4G. (lvcreate)
- Format it as reiserfs. (mkfs.reiserfs)
- Mount it to a temporary mount point.
- Copy files in /tmp over using rsync -av
- Go to single user mode and unmount /tmp
- Edit /etc/fstab to change /tmp to use the new lv.
- Remount /tmp and go into multi-user mode.
Note: the device to be put into fstab should be /dev/<vg>/<lv>, not /dev/mapper/<vg>-<lv>.
- Create a new lv (RAID-1 LVM) of 4G. (lvcreate)
- Format it as reiserfs. (mkfs.reiserfs)
- Mount it to a temporary mount point.
- Copy files in /tmp over using rsync -av
- Go to single user mode and unmount /tmp
- Edit /etc/fstab to change /tmp to use the new lv.
- Remount /tmp and go into multi-user mode.
Note: the device to be put into fstab should be /dev/<vg>/<lv>, not /dev/mapper/<vg>-<lv>.
Wednesday, May 14, 2008
Slackware RAID HOWTO 指南 (Chinese Translaction)
Slackware RAID HOWTO
Slackware RAID 指南
Version 1.00
2008/04/29
by Amritpal Bath
Contents
目录
===============================================================================
- Introduction
- Warnings
- Planning
- Setup
- Using the generic kernel
- Troubleshooting
- Appendices
- Acknowledgements/References
Introduction
简介
===============================================================================
This document explains how to install Slackware 12.1 (and beyond) on a
software RAID root filesystem. It is meant to cover only software raid.
If you are using a RAID expansion card, or the RAID functionality that came
with your motherboard, this document will not be useful for you.
本文解释了如何在一个基于软件RAID(廉价磁盘冗余阵列)的根文件系统上安装Slackware 12.1。本文只涵盖软件RAID。如果你使用RAID扩展卡,或者你的主板带有RAID功能,本文将不会对你有帮助。
In order to follow this document, your computer must have two or more empty
hard drives. While it is possible to be creative and create RAID arrays on
drives that already contain data, it can be error prone, so it is not
covered in this document.
你的电脑必须有两个以上的空硬盘你才可以跟着本文做。虽然你可以发挥创意,在已经有数据的硬盘上建立RAID阵列,但是这样做容易导致问题,所以本文不包括这方面的内容。
Warnings
警告
===============================================================================
If you perform the following instructions on hard drives with data on them,
YOU WILL LOSE ALL OF YOUR DATA.
如果你在有数据的硬盘上执行以下指令,上边的所有数据将会丢失。
If you wish to perform these operations on hard drives that hold data of
any importance, you MUST BACKUP YOUR DATA. The procedure below will
destroy all of the data on your hard drives, so any important data will
need to be restored from your backups.
如果你要在有重要数据的硬盘上执行以下指令,请先做好备份。下面的步骤会消除硬盘上的所有数据,所以你将需要从你的备份里恢复它们。
One more time: *BACKUP YOUR DATA, OR YOU WILL LOSE IT!*
再一次:备份你的数据,否则你将失去它们。
If you don't backup your data and end up losing it, it will be your fault.
There is nothing I can do to help you in that case.
如果你因为没有备份数据而导致数据丢失,那时你自己的错。我帮不了你。
Now, on with the show... :)
好了,我们开始吧... :)
Planning
计划
===============================================================================
The first step is to determine which RAID level you want to use.
第一步是决定你要哪个RAID级。
It is recommended that you familiarize yourself with basic RAID concepts,
such as the various RAID levels that are available to you. You can read
about these in various places - consult your favorite search engine about
"raid levels", or see the References section.
建议你先搞清楚RAID的基本概念,比如你可以使用的各个RAID级。你可以在很多地方找到这方面的信息 - 用你喜爱的搜索引擎查一查"raid levels"。或者看本文的“参考书目”一节。
Here's a quick summary of the more common RAID levels:
下面是对常见的RAID级的一个简单的总结:
- RAID 0: Requires 2 drives, can use more. Offers no redundancy, but
improves performance by "striping", or interleaving, data between all
drives. This RAID level does not help protect your data at all.
If you lose one drive, all of your data will be lost.
- RAID 0: 需要两个或者更多的设备。不支持冗余,但“striping",或者说interleaving(数据交替储存?),可以提高读写的性能。这个级别不能够保护你的数据。如果一个设备坏了,你所有的(在这个RAID设备上的)数据都会丢失。
- RAID 1: Requires 2 drives, can use more. Offers data redundancy by
mirroring data across all drives. This RAID level is the simplest way
to protect your data, but is not the most space-efficient method. For
example, if you use 3 drives in a RAID 1 array, you gain redundancy, but
you still have only 1 disk's worth of space available for use.
- RAID 1: 需要两个或者更多的设备。使用数据在各个设备上的镜像来提供冗余。这个级别是最简单的一种保护你的数据的方法。
- RAID 5: Requires 3 drives, can use more. Offers data redundancy by
storing parity data on each drive. Exactly one disk's worth of space
will be used to hold parity data, so while this RAID level is heaviest
on the CPU, it is also the most space efficient way of protecting your
data. For example, if you use 5 drives to create a RAID 5 array, you
will only lose 1 disk's worth of space (unlike RAID 1), so you will
end up with 4 disk's worth of space available for use. While simple to
setup, this level is not quite as straightforward as setting up RAID 1.
- RAID 5: 需要三个或者更多的设备。通过在每个设备上储存的奇偶数据来提供冗余。正好整一个设备大小的空间会用来储存奇偶数据,虽然这个RAID级用最多的CPU,但是他也是最有效率利用存储空间的保护数据的方法。比方说,如果你用5个设备来建立一个RAID 5阵列,你只失去了一个设备大小的空间(不像RAID 1),所以你可以有4个设备大小的空间用来存放数据。虽然设置起来简单,但是这个级别不象设置RAID 1那么容易。
Setup
设置
===============================================================================
=== Partition hard drives ===
硬盘分区
Once you have booted the Slackware installer CD, the first step is to
partition the hard drives that will be used in the RAID array(s).
你用Slackware安装光盘引导进系统之后,第一步就是给要在RAID阵列中使用的硬盘分区。
I will assume that your first RAID hard drive is /dev/sda. If it is
/dev/hda or something similar, adjust the following commands appropriately.
我假设你的第一个RAID硬盘是/dev/sda。如果它是/dev/hda或者其他类似的设备,你要对下面的命令作适当的调整。
You can see your drives by running: cat /proc/partitions
你可以运行这个来看你的硬盘:cat /proc/partitions
- /boot: RAID 0 and RAID 5 users will require a separate boot partition, as
the computer's BIOS will not understand striped devices. For
simplicity's sake, we will make /boot a small RAID 1 (mirror) array.
This means that in the case of RAID 0, it will not matter which drive
your BIOS attempts to boot, and in the case of RAID 5, losing one drive
will not result in losing your /boot partition.
- /boot: RAID 0 和 RAID 5 的使用者需要一个独立的引导分区,这是因为电脑的BIOS不能识别数据交替储存的设备。为简单起见,我们把/boot做成一个小的RAID 1阵列。这就是说,在RAID 0下面,你的BIOS可以用(这个RAID 1阵列里的)任何一个设备来引导。在RAID 5 下面,失去一个设备不会导致你失去/boot分区。
I recommend at least 30MB for this partition, to give yourself room to
play with multiple kernels in the future, should the need arise. I tend
to use 100MB, so I can put all sorts of bootable images on the partition,
such as MemTest86, for example.
我建议给这个分区至少30MB,以便让你将来有需要的话可以使用多个内核。我一般会给100MB,这样我可以把各种可引导的(内核)文件如MemTest86放在上面。
Go ahead and create a small boot partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).
现在在/dev/sda上用cfdisk或者fdisk建一个小的引导分区。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
- /: Every setup will require a root partition. :) You will likely want to
create a partition takes up most of the rest of the drive. Unless you
are using LVM (not covered in this document), remember to save some space
after this partition for your swap partition! (see below)
- /:每个配置多需要一个根分区。:) 你很可能想要然这个分区占掉硬盘上的大部分空间。除非你用LVM(不在本文范围内),否则记得留些空间给交换分区(见下)!
If you are not creating a swap partition, I recommend leaving 100MB of
unused space at the end of the drive. (see "safety" for explanation)
- 如果你不打算建交换分区,我建议在硬盘的末端留100MB空间。(解释见“安全性”一节)。
Go ahead and create your main partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).
现在在/dev/sda上用cfdisk或者fdisk建你的主分区。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
- swap: Swap space is where Linux stores data when you're running low on
available RAM. For fairly obvious reasons, building this on RAID 0 could
be painful (if that array develops a bad sector, for example), so I tend
to build swap on RAID 1 as well. If you understand the danger and still
want to build swap on RAID 0 to eke out as much performance as possible,
go for it.
- swap: 交换空间是Linux在内存不够的时候存放数据的地方。显而易见的,把它建在RAID 0上可能会很糟糕(比如说,那个阵列出了一个坏扇区),所以我一般也把它建在RAID 1上。如果你明白其中的危险性,但是还是想把它建在RAID 0上以尽可能多的提升性能,也是可以。
For RAID 1 swap, create a partition that is the exact size that you want
your swap space to be (for example, 2GB, if you can't decide).
对于RAID 1 交换分区,你想要多大,就建一个多大的分区。(如果你不能决定,就放2GB)
For RAID 0 swap (not recommended), create a partition that is equivalent
to the swap size you want, divided by the number of drives that will be
in the array.
对于RAID 1 交换分区,建一个大小为你想要的大小除以设备的数目的分区。
For example, 2GB / 3 drives = 683MB swap partition on /dev/sda.
比如说,2GB / 3个硬盘 = 683MB 交换分区 在/dev/sda上。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
I recommend leaving 100MB of unused space at the end of the drive.
(see "safety" for explanation)
我建议在硬盘的末端留100MB空间。(解释见“安全性”一节)。
See also: Appendix A - Striping swap space without RAID 0.
又见:附录A - 不用RAID 0来交替储存交换空间。
- safety! I highly recommend leaving 100MB of unpartitioned space at the
end of each drive that will be used in the RAID array(s).
- 安全性!我极力推荐在每个RAID阵列设备的末端留100MB为分区的空间。
In the event that you need to replace one of the drives in the array,
there is no guarantee that the new drive will be exactly the same size as
the drive that you are replacing. For example, even if both drives are
750GB, they may be different revisions or manufacturers, and thus have a
size difference of some small number of megabytes.
如果你需要更换阵列中的一个设备的话,新的硬盘不一定和原来的正好完全一样大小。比方说,就算两个硬盘都是750GB,它们可能属于不同的版本或者制造商,因此可能会有几兆的差异。
This is, however, enough to throw a wrench in your drive-replacement
plans - you cannot replace a failed RAID drive with one of a smaller size,
for obvious reasons. Having that small 100MB buffer just may save your
bacon.
然而,这足以扰乱你的硬盘更换计划。很显然,你不能用一个小一点的硬盘来换掉坏掉的硬盘。留100MB的缓冲空间可以预防这个问题。
=== Copy and review partitions ===
复制与检查分区
Now that /dev/sda is partitioned as appropriate, copy the partitions to all
the other drives to be used in your RAID arrays.
/dev/sda分好区之后,把它的分区拷贝到RAID阵列里的所有其他硬盘。
An easy way to do this is:
一个简单的方法是:
sfdisk -d /dev/sda | sfdisk /dev/sdb
This will destroy all partitions on /dev/sdb, and replicate /dev/sda's
partition setup onto it.
这会毁掉/dev/sdb里的所有分区,并把/dev/sda的分区复制到/dev/sdb。
After this, your partitions should look something like the following:
这之后,你的分区会大概是下面这个情况:
- RAID 0:
/dev/sda1 30MB /dev/sdb1 30MB
/dev/sda2 100GB /dev/sdb2 100GB
/dev/sda3 2GB /dev/sdb3 2GB
- RAID 1:
/dev/sda1 100GB /dev/sdb1 100GB
/dev/sda2 2GB /dev/sdb2 2GB
- RAID 5:
/dev/sda1 30MB /dev/sdb1 30MB /dev/sdc1 30MB
/dev/sda2 100GB /dev/sdb2 100GB /dev/sdc2 100GB
/dev/sda3 2GB /dev/sdb3 2GB /dev/sdc3 2GB
All partition types should be Linux RAID Autodetect (type fd).
所有分区类型都应该是Linux RAID Autodetect (type FD)。
=== Create RAID arrays ===
建立RAID阵列
Now it's time to create the actual RAID arrays based on the partitions that
were created.
现在是时候在你的分区上建立RAID阵列了。
The parameters for each of these RAID commands specifies, in order:
每个RAID命令的参数依次是:
- the RAID device node to create (--create /dev/mdX)
- 要建立的RAID设备节点 (--create /dev/mdX)
- the RAID level to use for this array (--level X)
- 要使用的RAID级 (--level X)
- how many devices (partitions) to use in the array (--raid-devices X)
- 在这个阵列里有多少个设备(分区)(--raid-devices X)
- the actual list of devices (/dev/sdaX /dev/sdbX /dev/sdcX)
- 实际设备列单 (/dev/sdaX /dev/sdbX /dev/sdcX)
Start by creating the RAID array for your root filesystem.
首先建立根文件系统的RAID阵列。
- RAID 0:
mdadm --create /dev/md0 --level 0 --raid-devices 2 \
/dev/sda2 /dev/sdb2
- RAID 1:
mdadm --create /dev/md0 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1
- RAID 5:
mdadm --create /dev/md0 --level 5 --raid-devices 3 \
/dev/sda2 /dev/sdb2 /dev/sdc2
Next, let's create the array for the swap partition. This will be RAID 1
regardless of which RAID level your root filesystem uses, but given our
partition layouts, each command will still be slightly different.
其次,建立交换分区阵列。不论你的根文件系统用哪个RAID级,这个都是RAID 1。但是因为我们不同的分区分布,每个命令还是会有一点不同。
- RAID 0:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda3 /dev/sdb3
- RAID 1:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda2 /dev/sdb2
- RAID 5:
mdadm --create /dev/md1 --level 1 --raid-devices 3 \
/dev/sda3 /dev/sdb3 /dev/sdc3
Finally, RAID 0 and RAID 5 users will need to create their /boot array.
RAID 1 users do not need to do this.
最后,RAID 0 和 RAID 5 用户需要建立/boot 阵列。RAID 1用户不需要。
- RAID 0:
mdadm --create /dev/md2 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1
- RAID 5:
mdadm --create /dev/md2 --level 1 --raid-devices 3 \
/dev/sda1 /dev/sdb1 /dev/sdc1
We're all done creating our arrays! Yay!
所有的阵列都建好了!Yay!
=== Run Slackware setup ===
运行Slackware安装
First, let's format our swap array, so the installer recognizes it:
首先,格式化交换阵列,让安装程序可以识别它。
mkswap /dev/md1
Now run 'setup' as normal.
接下去如常运行'setup'。
When you choose to setup your swap partitions, /dev/md1 will show up.
Continue with this selected.
当你选择设置你的交换分区时,/dev/md1会出现在选项里。选它然后继续。
When asked for the target partition, choose the root array (/dev/md0).
当让你选择目标分区时,选根阵列(/dev/md0)。
You may choose the format method and filesystem of your choice.
你可以选择你要的文件系统和格式化方法。
RAID 0 and RAID 5 users must also setup /boot. When asked about setting up
extra partitions, choose /dev/md2. When asked where to mount this device,
enter "/boot".
RAID 0 和 RAID 5 用户必须设置/boot。当然你设置额外的分区时,选/dev/md2。当问你挂载到哪里时,输入/boot。
After this, continue installation as normal.
之后,照常继续安装。
For LILO configuration:
- When asked about LILO, choose the "simple" setup.
- When asked about additional "append=" parameters, RAID 0 and
RAID 5 users should type in "root=/dev/md0", to ensure that the proper
array is mounted on / at bootup.
- When asked about where to install LILO, choose MBR.
LILO设置:
- 当问你LILO设置时,选“simple”设置。
- 当问你附加的"append="参数时,RAID 0 和 RAID 5 用户要输入"root=/dev/md0" 以确保引导时正确的阵列会被挂载到/上。
- 当问你把LILO安装到哪里时,选MBR。
You may see some warnings scroll by. This is OK.
你可能会看到一些警告信息,那些不碍事。
=== Finishing touches ===
完成安装
After exiting the installer, we have just a few settings to tweak.
推出安装程序后,还有几个设置要“搞”一下。
Start by switching into your actual installation directory:
首先切换进你的系统所安装到的目录。
- chroot /mnt
Let's make sure LILO boots from the RAID arrays properly. Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
确保LILO是从正确的RAID阵列引导的。用你喜欢的编辑器(vim/nano/pico)编辑/etc/lilo.conf:
- add a new line (add it anywhere, but don't indent it):
- 加入一行(随便哪里,但是不要缩进):
raid-extra-boot = mbr-only
- You will need to change the following line:
- 修改这一行:
boot =
RAID 0 and RAID 5 users, change it to:
RAID 0 和 RAID 5 用户改成:
boot = /dev/md2
RAID 1 users, change it to:
RAID 1 用户改成:
boot = /dev/md0
- Save the file and exit your editor.
- 保存文件,推出编辑器。
- run "lilo".
- 运行“lilo”。
When that's done, let's exit the installation and reboot:
完成后,退出安装,重启:
- exit
- reboot
Voila!
完成!
Using the generic kernel
使用generic内核
===============================================================================
The official Slackware recommendation is to switch to the "generic"
Slackware kernel after installation has been completed. If you wish to use
the generic kernel, you must create an initrd. This section gives a quick
example of booting a RAID system in this fashion.
Slackware官方推荐完成安装后换去使用generic内核。如果你想用generic内核的话,就要建立一个initrd。这一节简单讲述如何用这个方法启动一个RAID系统。
If you require more information on initrds, please read /boot/README.initrd.
如果你需要更多关于initrd的信息,请读/boot/README.initrd。
Typically, a user switches to a generic kernel by booting the system, and
afterwards running the following:
一般来说,用户要启动系统并做以下步骤来切换到generic内核:
- cd /boot
- rm vmlinuz System.map config
- ln -s vmlinuz-generic-smp-* vmlinuz
- ln -s System.map-generic-smp-* System.map
- ln -s config-generic-smp-* config
Don't run lilo yet, we'll do that soon.
先不要巡行lilo。我们马上就会做到那一步。
Next, edit (create, if necessary) /etc/mkinitrd.conf and add:
其次,编辑(如有必要,创建)/etc/mkinitrd.conf 并加入:
MODULE_LIST="ext3"
RAID="1"
Obviously, this assumes that you are using the EXT3 filesystem. If you are
using another filesystem, adjust the module appropriately (reiserfs or xfs,
for example). If you wish to read more about the MODULE_LIST variable,
consult "man mkinitrd.conf".
显然,这里假设你用EXT3文件系统。如果你用其他的文件系统,适当修改模块行(比如reiserfs,xfs)。如果你要了解更多关于MODULE_LIST变量,参考"man mkinitrd.conf"。
Note: If the module for your hard drive controller is not compiled into the
generic kernel, you will want to add that module to the MODULE_LIST variable
in mkinitrd.conf. For example, my controller requires the mptspi module, so
my /etc/mkinitrd.conf looks like:
注意:如果你的硬盘控制器的模块没有被编译到generic内核的话,你需要把他加到mkinitrd.conf的MODULE_LIST变量里。比如,我的控制器需要mptspi模块,所以我的/etc/mkinitrd.conf是这样的:
MODULE_LIST="ext3:mptspi"
RAID="1"
We're almost done.
差不多了。
Edit /etc/lilo.conf, and find the line at the very end that says:
编辑/etc/lilo.conf,找到这一行:
image = /boot/vmlinuz
Add a new line after it that says:
在它之后加入这行:
initrd = /boot/initrd.gz
In this case, be sure to indent the line you've added!
这个时候,确保加入的这行有缩进。
Next, create the initrd based on the config file created earlier.
接下去,根据之前建立的配置文件创建initrd。
mkinitrd -F
Finally, run "lilo" to make the new settings take effect, give yourself a
pat on the back, and reboot your finished system. :)
最后,运行“lilo”让新的设置生效。拍拍你自己的背,然后启动完成的系统。
Troubleshooting
故障检查
===============================================================================
Any number of typos can result in a system that does not boot on its own,
but all is not lost. Put the rubber chicken and the lemon away...
无论多少的打字错误都可能导致你的系统不能启动。不过这并不意味着全完了。(下一句不会 :P)
Booting your Slackware media (DVD, for example) can make it very easy to
switch into your installed system and make repairs:
用你的Slackware介质(比如DVD)启动系统。这可以让你非常容易的切换到你安装好的系统来进行修理。
- Boot Slackware CD/DVD.
- 启动Slackware CD/DVD。
- Login to installer as normal.
- 如常登录进安装程序。
- Scan for, and then assemble the RAID arrays:
- 扫描并组装RAID阵列:
mdadm -Es > /etc/mdadm.conf
mdadm -As
- Mount root partition:
- 挂载根分区:
mount /dev/md0 /mnt
- Switch to installed OS:
- 切换到安装好的系统:
chroot /mnt
- Mount remaining filesystems:
- 挂载其他的文件系统:
mount /boot (RAID 0 and RAID 5 users only)
mount /proc
mount sys /sys -t sysfs
At this point, you can bring up your favorite editor, tweak config files,
re-run mkinitrd/lilo/etc as you wish, or anything else you need to do to
make your system bootable again.
到这里,你可以打开你喜欢的编辑器,修改配置文件,重新运行mkinitrd/lilo/等等,或者任何其他让你的系统可以正常引导要做的事情。
When you're finished making your changes, rebooting is simple:
当你做完了改动后,重新启动很简单:
- cd /
- umount boot proc sys
- exit
- reboot
If you are having issues that you're unable to resolve, shoot me an email.
Perhaps the answer will make it into this section. :)
如果你又不能解决的问题,给我发个电邮。也许答案会被加到这一节里。
Appendices
附录
===============================================================================
=== Appendix A: Striping swap space without RAID 0 ===
附录A:不用RAID 0来交替储存交换空间
For completeness' sake, I should mention that swap space can be striped to
improve performance without creating a RAID 0 array.
为了完整性,我应该阐明不需要RAID 0阵列也可以做到交替储存交换空间。
To accomplish this, start by forgetting about any instructions having to do
with /dev/md1, which would be our swap array - create the swap partitions on
the hard drives, but do not create this particular array.
为了做到这点,先不要管关于/dev/md1(我们的交换阵列)的指令 - 在硬盘上建立交换分区,但是不要建立这个阵列。
When creating the swap partitions, ensure that the partition type is set to
Linux Swap (type 82).
当建立交换分区时,确保分区类型是Linux Swap (type 82)。
During setup, the installer will recognize the swap partitions. Ensure that
all of them are selected, and continue as normal.
在安装过程中,安装程序会识别交换分区。确保所有的分区都被选上。如常继续。
After installation is complete, go ahead and boot your system - we can
finish this once the system is booted, in the interest of simplicity.
安装完成后,重启系统 - 重启后我们就可以完成安装了。
When the system boots, edit /etc/fstab with your favorite editor. Find the
lines that describe your swap partitions - they say "swap" in the second
column.
系统启动后,编辑/etc/fstab。找到描述你的交换分区的那些行 - 第二列是"swap"的哪些。
Each of these lines says "default" in the fourth column. Simply change that
to "default,pri=0" for each line.
每一行的第四列都是“default”。把它们都改成“default,pri=0”。
After saving the file, either reboot, or simply run:
保存文件后,要么重启,要么只要运行:
swapoff -a
swapon -a
To confirm that the setting has taken effect, you can run:
可以运行一下来确认设置生效了:
swapon -s
Verify that the Priority column reads 0 for each partition, and we're done!
检查每个分区的Priority列都是0,就完成了!
Acknowledgements/References
感谢/参考书目
===============================================================================
- In depth explanation of RAID levels:
"LasCon Storage - Different types of RAID"
http://www.lascon.co.uk/d008005.htm
- Thanks to John Jenkins (mrgoblin) for some tips in:
"Installing with Raid on Slackware 12.0+"
http://www.userlocal.com/articles/raid1-slackware-12.php
- Thanks to Karl Magnus Kolst?(karlmag) for his original writeup on
Slackware and RAID, ages ago!
"INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON A SOFTWARE
RAID level 0 DEVICE"
http://www.userlocal.com/articles/raid0-slackware-linux.php
- Of course, thanks to Patrick "The Man" Volkerding for creating Slackware!
http://slackware.com/
- Also thanks to the rest of the guys that proofread, tested, and suggested!
Eric Hameleers (alienBOB), Robby Workman, Alan Hicks,
Piter Punk, Erik Jan Tromp (alphageek)...
- My contact info:
作者联系方法:
Primary email: amrit@slackware.com
Secondary email: amrit@transamrit.net
On certain IRC networks: "amrit" (or some variation :) )
- This latest version of this document can be found at:
最新版本位于:
http://slackware.com/~amrit/
http://transamrit.net/docs/slackware/
Slackware RAID 指南
Version 1.00
2008/04/29
by Amritpal Bath
Contents
目录
===============================================================================
- Introduction
- Warnings
- Planning
- Setup
- Using the generic kernel
- Troubleshooting
- Appendices
- Acknowledgements/References
Introduction
简介
===============================================================================
This document explains how to install Slackware 12.1 (and beyond) on a
software RAID root filesystem. It is meant to cover only software raid.
If you are using a RAID expansion card, or the RAID functionality that came
with your motherboard, this document will not be useful for you.
本文解释了如何在一个基于软件RAID(廉价磁盘冗余阵列)的根文件系统上安装Slackware 12.1。本文只涵盖软件RAID。如果你使用RAID扩展卡,或者你的主板带有RAID功能,本文将不会对你有帮助。
In order to follow this document, your computer must have two or more empty
hard drives. While it is possible to be creative and create RAID arrays on
drives that already contain data, it can be error prone, so it is not
covered in this document.
你的电脑必须有两个以上的空硬盘你才可以跟着本文做。虽然你可以发挥创意,在已经有数据的硬盘上建立RAID阵列,但是这样做容易导致问题,所以本文不包括这方面的内容。
Warnings
警告
===============================================================================
If you perform the following instructions on hard drives with data on them,
YOU WILL LOSE ALL OF YOUR DATA.
如果你在有数据的硬盘上执行以下指令,上边的所有数据将会丢失。
If you wish to perform these operations on hard drives that hold data of
any importance, you MUST BACKUP YOUR DATA. The procedure below will
destroy all of the data on your hard drives, so any important data will
need to be restored from your backups.
如果你要在有重要数据的硬盘上执行以下指令,请先做好备份。下面的步骤会消除硬盘上的所有数据,所以你将需要从你的备份里恢复它们。
One more time: *BACKUP YOUR DATA, OR YOU WILL LOSE IT!*
再一次:备份你的数据,否则你将失去它们。
If you don't backup your data and end up losing it, it will be your fault.
There is nothing I can do to help you in that case.
如果你因为没有备份数据而导致数据丢失,那时你自己的错。我帮不了你。
Now, on with the show... :)
好了,我们开始吧... :)
Planning
计划
===============================================================================
The first step is to determine which RAID level you want to use.
第一步是决定你要哪个RAID级。
It is recommended that you familiarize yourself with basic RAID concepts,
such as the various RAID levels that are available to you. You can read
about these in various places - consult your favorite search engine about
"raid levels", or see the References section.
建议你先搞清楚RAID的基本概念,比如你可以使用的各个RAID级。你可以在很多地方找到这方面的信息 - 用你喜爱的搜索引擎查一查"raid levels"。或者看本文的“参考书目”一节。
Here's a quick summary of the more common RAID levels:
下面是对常见的RAID级的一个简单的总结:
- RAID 0: Requires 2 drives, can use more. Offers no redundancy, but
improves performance by "striping", or interleaving, data between all
drives. This RAID level does not help protect your data at all.
If you lose one drive, all of your data will be lost.
- RAID 0: 需要两个或者更多的设备。不支持冗余,但“striping",或者说interleaving(数据交替储存?),可以提高读写的性能。这个级别不能够保护你的数据。如果一个设备坏了,你所有的(在这个RAID设备上的)数据都会丢失。
- RAID 1: Requires 2 drives, can use more. Offers data redundancy by
mirroring data across all drives. This RAID level is the simplest way
to protect your data, but is not the most space-efficient method. For
example, if you use 3 drives in a RAID 1 array, you gain redundancy, but
you still have only 1 disk's worth of space available for use.
- RAID 1: 需要两个或者更多的设备。使用数据在各个设备上的镜像来提供冗余。这个级别是最简单的一种保护你的数据的方法。
- RAID 5: Requires 3 drives, can use more. Offers data redundancy by
storing parity data on each drive. Exactly one disk's worth of space
will be used to hold parity data, so while this RAID level is heaviest
on the CPU, it is also the most space efficient way of protecting your
data. For example, if you use 5 drives to create a RAID 5 array, you
will only lose 1 disk's worth of space (unlike RAID 1), so you will
end up with 4 disk's worth of space available for use. While simple to
setup, this level is not quite as straightforward as setting up RAID 1.
- RAID 5: 需要三个或者更多的设备。通过在每个设备上储存的奇偶数据来提供冗余。正好整一个设备大小的空间会用来储存奇偶数据,虽然这个RAID级用最多的CPU,但是他也是最有效率利用存储空间的保护数据的方法。比方说,如果你用5个设备来建立一个RAID 5阵列,你只失去了一个设备大小的空间(不像RAID 1),所以你可以有4个设备大小的空间用来存放数据。虽然设置起来简单,但是这个级别不象设置RAID 1那么容易。
Setup
设置
===============================================================================
=== Partition hard drives ===
硬盘分区
Once you have booted the Slackware installer CD, the first step is to
partition the hard drives that will be used in the RAID array(s).
你用Slackware安装光盘引导进系统之后,第一步就是给要在RAID阵列中使用的硬盘分区。
I will assume that your first RAID hard drive is /dev/sda. If it is
/dev/hda or something similar, adjust the following commands appropriately.
我假设你的第一个RAID硬盘是/dev/sda。如果它是/dev/hda或者其他类似的设备,你要对下面的命令作适当的调整。
You can see your drives by running: cat /proc/partitions
你可以运行这个来看你的硬盘:cat /proc/partitions
- /boot: RAID 0 and RAID 5 users will require a separate boot partition, as
the computer's BIOS will not understand striped devices. For
simplicity's sake, we will make /boot a small RAID 1 (mirror) array.
This means that in the case of RAID 0, it will not matter which drive
your BIOS attempts to boot, and in the case of RAID 5, losing one drive
will not result in losing your /boot partition.
- /boot: RAID 0 和 RAID 5 的使用者需要一个独立的引导分区,这是因为电脑的BIOS不能识别数据交替储存的设备。为简单起见,我们把/boot做成一个小的RAID 1阵列。这就是说,在RAID 0下面,你的BIOS可以用(这个RAID 1阵列里的)任何一个设备来引导。在RAID 5 下面,失去一个设备不会导致你失去/boot分区。
I recommend at least 30MB for this partition, to give yourself room to
play with multiple kernels in the future, should the need arise. I tend
to use 100MB, so I can put all sorts of bootable images on the partition,
such as MemTest86, for example.
我建议给这个分区至少30MB,以便让你将来有需要的话可以使用多个内核。我一般会给100MB,这样我可以把各种可引导的(内核)文件如MemTest86放在上面。
Go ahead and create a small boot partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).
现在在/dev/sda上用cfdisk或者fdisk建一个小的引导分区。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
- /: Every setup will require a root partition. :) You will likely want to
create a partition takes up most of the rest of the drive. Unless you
are using LVM (not covered in this document), remember to save some space
after this partition for your swap partition! (see below)
- /:每个配置多需要一个根分区。:) 你很可能想要然这个分区占掉硬盘上的大部分空间。除非你用LVM(不在本文范围内),否则记得留些空间给交换分区(见下)!
If you are not creating a swap partition, I recommend leaving 100MB of
unused space at the end of the drive. (see "safety" for explanation)
- 如果你不打算建交换分区,我建议在硬盘的末端留100MB空间。(解释见“安全性”一节)。
Go ahead and create your main partition now on /dev/sda, via cfdisk
(or fdisk, if you prefer).
现在在/dev/sda上用cfdisk或者fdisk建你的主分区。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
- swap: Swap space is where Linux stores data when you're running low on
available RAM. For fairly obvious reasons, building this on RAID 0 could
be painful (if that array develops a bad sector, for example), so I tend
to build swap on RAID 1 as well. If you understand the danger and still
want to build swap on RAID 0 to eke out as much performance as possible,
go for it.
- swap: 交换空间是Linux在内存不够的时候存放数据的地方。显而易见的,把它建在RAID 0上可能会很糟糕(比如说,那个阵列出了一个坏扇区),所以我一般也把它建在RAID 1上。如果你明白其中的危险性,但是还是想把它建在RAID 0上以尽可能多的提升性能,也是可以。
For RAID 1 swap, create a partition that is the exact size that you want
your swap space to be (for example, 2GB, if you can't decide).
对于RAID 1 交换分区,你想要多大,就建一个多大的分区。(如果你不能决定,就放2GB)
For RAID 0 swap (not recommended), create a partition that is equivalent
to the swap size you want, divided by the number of drives that will be
in the array.
对于RAID 1 交换分区,建一个大小为你想要的大小除以设备的数目的分区。
For example, 2GB / 3 drives = 683MB swap partition on /dev/sda.
比如说,2GB / 3个硬盘 = 683MB 交换分区 在/dev/sda上。
Ensure that the partition type is Linux RAID Autodetect (type FD).
确保分区类型是Linux RAID Autodetect (type FD)。
I recommend leaving 100MB of unused space at the end of the drive.
(see "safety" for explanation)
我建议在硬盘的末端留100MB空间。(解释见“安全性”一节)。
See also: Appendix A - Striping swap space without RAID 0.
又见:附录A - 不用RAID 0来交替储存交换空间。
- safety! I highly recommend leaving 100MB of unpartitioned space at the
end of each drive that will be used in the RAID array(s).
- 安全性!我极力推荐在每个RAID阵列设备的末端留100MB为分区的空间。
In the event that you need to replace one of the drives in the array,
there is no guarantee that the new drive will be exactly the same size as
the drive that you are replacing. For example, even if both drives are
750GB, they may be different revisions or manufacturers, and thus have a
size difference of some small number of megabytes.
如果你需要更换阵列中的一个设备的话,新的硬盘不一定和原来的正好完全一样大小。比方说,就算两个硬盘都是750GB,它们可能属于不同的版本或者制造商,因此可能会有几兆的差异。
This is, however, enough to throw a wrench in your drive-replacement
plans - you cannot replace a failed RAID drive with one of a smaller size,
for obvious reasons. Having that small 100MB buffer just may save your
bacon.
然而,这足以扰乱你的硬盘更换计划。很显然,你不能用一个小一点的硬盘来换掉坏掉的硬盘。留100MB的缓冲空间可以预防这个问题。
=== Copy and review partitions ===
复制与检查分区
Now that /dev/sda is partitioned as appropriate, copy the partitions to all
the other drives to be used in your RAID arrays.
/dev/sda分好区之后,把它的分区拷贝到RAID阵列里的所有其他硬盘。
An easy way to do this is:
一个简单的方法是:
sfdisk -d /dev/sda | sfdisk /dev/sdb
This will destroy all partitions on /dev/sdb, and replicate /dev/sda's
partition setup onto it.
这会毁掉/dev/sdb里的所有分区,并把/dev/sda的分区复制到/dev/sdb。
After this, your partitions should look something like the following:
这之后,你的分区会大概是下面这个情况:
- RAID 0:
/dev/sda1 30MB /dev/sdb1 30MB
/dev/sda2 100GB /dev/sdb2 100GB
/dev/sda3 2GB /dev/sdb3 2GB
- RAID 1:
/dev/sda1 100GB /dev/sdb1 100GB
/dev/sda2 2GB /dev/sdb2 2GB
- RAID 5:
/dev/sda1 30MB /dev/sdb1 30MB /dev/sdc1 30MB
/dev/sda2 100GB /dev/sdb2 100GB /dev/sdc2 100GB
/dev/sda3 2GB /dev/sdb3 2GB /dev/sdc3 2GB
All partition types should be Linux RAID Autodetect (type fd).
所有分区类型都应该是Linux RAID Autodetect (type FD)。
=== Create RAID arrays ===
建立RAID阵列
Now it's time to create the actual RAID arrays based on the partitions that
were created.
现在是时候在你的分区上建立RAID阵列了。
The parameters for each of these RAID commands specifies, in order:
每个RAID命令的参数依次是:
- the RAID device node to create (--create /dev/mdX)
- 要建立的RAID设备节点 (--create /dev/mdX)
- the RAID level to use for this array (--level X)
- 要使用的RAID级 (--level X)
- how many devices (partitions) to use in the array (--raid-devices X)
- 在这个阵列里有多少个设备(分区)(--raid-devices X)
- the actual list of devices (/dev/sdaX /dev/sdbX /dev/sdcX)
- 实际设备列单 (/dev/sdaX /dev/sdbX /dev/sdcX)
Start by creating the RAID array for your root filesystem.
首先建立根文件系统的RAID阵列。
- RAID 0:
mdadm --create /dev/md0 --level 0 --raid-devices 2 \
/dev/sda2 /dev/sdb2
- RAID 1:
mdadm --create /dev/md0 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1
- RAID 5:
mdadm --create /dev/md0 --level 5 --raid-devices 3 \
/dev/sda2 /dev/sdb2 /dev/sdc2
Next, let's create the array for the swap partition. This will be RAID 1
regardless of which RAID level your root filesystem uses, but given our
partition layouts, each command will still be slightly different.
其次,建立交换分区阵列。不论你的根文件系统用哪个RAID级,这个都是RAID 1。但是因为我们不同的分区分布,每个命令还是会有一点不同。
- RAID 0:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda3 /dev/sdb3
- RAID 1:
mdadm --create /dev/md1 --level 1 --raid-devices 2 \
/dev/sda2 /dev/sdb2
- RAID 5:
mdadm --create /dev/md1 --level 1 --raid-devices 3 \
/dev/sda3 /dev/sdb3 /dev/sdc3
Finally, RAID 0 and RAID 5 users will need to create their /boot array.
RAID 1 users do not need to do this.
最后,RAID 0 和 RAID 5 用户需要建立/boot 阵列。RAID 1用户不需要。
- RAID 0:
mdadm --create /dev/md2 --level 1 --raid-devices 2 \
/dev/sda1 /dev/sdb1
- RAID 5:
mdadm --create /dev/md2 --level 1 --raid-devices 3 \
/dev/sda1 /dev/sdb1 /dev/sdc1
We're all done creating our arrays! Yay!
所有的阵列都建好了!Yay!
=== Run Slackware setup ===
运行Slackware安装
First, let's format our swap array, so the installer recognizes it:
首先,格式化交换阵列,让安装程序可以识别它。
mkswap /dev/md1
Now run 'setup' as normal.
接下去如常运行'setup'。
When you choose to setup your swap partitions, /dev/md1 will show up.
Continue with this selected.
当你选择设置你的交换分区时,/dev/md1会出现在选项里。选它然后继续。
When asked for the target partition, choose the root array (/dev/md0).
当让你选择目标分区时,选根阵列(/dev/md0)。
You may choose the format method and filesystem of your choice.
你可以选择你要的文件系统和格式化方法。
RAID 0 and RAID 5 users must also setup /boot. When asked about setting up
extra partitions, choose /dev/md2. When asked where to mount this device,
enter "/boot".
RAID 0 和 RAID 5 用户必须设置/boot。当然你设置额外的分区时,选/dev/md2。当问你挂载到哪里时,输入/boot。
After this, continue installation as normal.
之后,照常继续安装。
For LILO configuration:
- When asked about LILO, choose the "simple" setup.
- When asked about additional "append=" parameters, RAID 0 and
RAID 5 users should type in "root=/dev/md0", to ensure that the proper
array is mounted on / at bootup.
- When asked about where to install LILO, choose MBR.
LILO设置:
- 当问你LILO设置时,选“simple”设置。
- 当问你附加的"append="参数时,RAID 0 和 RAID 5 用户要输入"root=/dev/md0" 以确保引导时正确的阵列会被挂载到/上。
- 当问你把LILO安装到哪里时,选MBR。
You may see some warnings scroll by. This is OK.
你可能会看到一些警告信息,那些不碍事。
=== Finishing touches ===
完成安装
After exiting the installer, we have just a few settings to tweak.
推出安装程序后,还有几个设置要“搞”一下。
Start by switching into your actual installation directory:
首先切换进你的系统所安装到的目录。
- chroot /mnt
Let's make sure LILO boots from the RAID arrays properly. Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
确保LILO是从正确的RAID阵列引导的。用你喜欢的编辑器(vim/nano/pico)编辑/etc/lilo.conf:
- add a new line (add it anywhere, but don't indent it):
- 加入一行(随便哪里,但是不要缩进):
raid-extra-boot = mbr-only
- You will need to change the following line:
- 修改这一行:
boot =
RAID 0 and RAID 5 users, change it to:
RAID 0 和 RAID 5 用户改成:
boot = /dev/md2
RAID 1 users, change it to:
RAID 1 用户改成:
boot = /dev/md0
- Save the file and exit your editor.
- 保存文件,推出编辑器。
- run "lilo".
- 运行“lilo”。
When that's done, let's exit the installation and reboot:
完成后,退出安装,重启:
- exit
- reboot
Voila!
完成!
Using the generic kernel
使用generic内核
===============================================================================
The official Slackware recommendation is to switch to the "generic"
Slackware kernel after installation has been completed. If you wish to use
the generic kernel, you must create an initrd. This section gives a quick
example of booting a RAID system in this fashion.
Slackware官方推荐完成安装后换去使用generic内核。如果你想用generic内核的话,就要建立一个initrd。这一节简单讲述如何用这个方法启动一个RAID系统。
If you require more information on initrds, please read /boot/README.initrd.
如果你需要更多关于initrd的信息,请读/boot/README.initrd。
Typically, a user switches to a generic kernel by booting the system, and
afterwards running the following:
一般来说,用户要启动系统并做以下步骤来切换到generic内核:
- cd /boot
- rm vmlinuz System.map config
- ln -s vmlinuz-generic-smp-* vmlinuz
- ln -s System.map-generic-smp-* System.map
- ln -s config-generic-smp-* config
Don't run lilo yet, we'll do that soon.
先不要巡行lilo。我们马上就会做到那一步。
Next, edit (create, if necessary) /etc/mkinitrd.conf and add:
其次,编辑(如有必要,创建)/etc/mkinitrd.conf 并加入:
MODULE_LIST="ext3"
RAID="1"
Obviously, this assumes that you are using the EXT3 filesystem. If you are
using another filesystem, adjust the module appropriately (reiserfs or xfs,
for example). If you wish to read more about the MODULE_LIST variable,
consult "man mkinitrd.conf".
显然,这里假设你用EXT3文件系统。如果你用其他的文件系统,适当修改模块行(比如reiserfs,xfs)。如果你要了解更多关于MODULE_LIST变量,参考"man mkinitrd.conf"。
Note: If the module for your hard drive controller is not compiled into the
generic kernel, you will want to add that module to the MODULE_LIST variable
in mkinitrd.conf. For example, my controller requires the mptspi module, so
my /etc/mkinitrd.conf looks like:
注意:如果你的硬盘控制器的模块没有被编译到generic内核的话,你需要把他加到mkinitrd.conf的MODULE_LIST变量里。比如,我的控制器需要mptspi模块,所以我的/etc/mkinitrd.conf是这样的:
MODULE_LIST="ext3:mptspi"
RAID="1"
We're almost done.
差不多了。
Edit /etc/lilo.conf, and find the line at the very end that says:
编辑/etc/lilo.conf,找到这一行:
image = /boot/vmlinuz
Add a new line after it that says:
在它之后加入这行:
initrd = /boot/initrd.gz
In this case, be sure to indent the line you've added!
这个时候,确保加入的这行有缩进。
Next, create the initrd based on the config file created earlier.
接下去,根据之前建立的配置文件创建initrd。
mkinitrd -F
Finally, run "lilo" to make the new settings take effect, give yourself a
pat on the back, and reboot your finished system. :)
最后,运行“lilo”让新的设置生效。拍拍你自己的背,然后启动完成的系统。
Troubleshooting
故障检查
===============================================================================
Any number of typos can result in a system that does not boot on its own,
but all is not lost. Put the rubber chicken and the lemon away...
无论多少的打字错误都可能导致你的系统不能启动。不过这并不意味着全完了。(下一句不会 :P)
Booting your Slackware media (DVD, for example) can make it very easy to
switch into your installed system and make repairs:
用你的Slackware介质(比如DVD)启动系统。这可以让你非常容易的切换到你安装好的系统来进行修理。
- Boot Slackware CD/DVD.
- 启动Slackware CD/DVD。
- Login to installer as normal.
- 如常登录进安装程序。
- Scan for, and then assemble the RAID arrays:
- 扫描并组装RAID阵列:
mdadm -Es > /etc/mdadm.conf
mdadm -As
- Mount root partition:
- 挂载根分区:
mount /dev/md0 /mnt
- Switch to installed OS:
- 切换到安装好的系统:
chroot /mnt
- Mount remaining filesystems:
- 挂载其他的文件系统:
mount /boot (RAID 0 and RAID 5 users only)
mount /proc
mount sys /sys -t sysfs
At this point, you can bring up your favorite editor, tweak config files,
re-run mkinitrd/lilo/etc as you wish, or anything else you need to do to
make your system bootable again.
到这里,你可以打开你喜欢的编辑器,修改配置文件,重新运行mkinitrd/lilo/等等,或者任何其他让你的系统可以正常引导要做的事情。
When you're finished making your changes, rebooting is simple:
当你做完了改动后,重新启动很简单:
- cd /
- umount boot proc sys
- exit
- reboot
If you are having issues that you're unable to resolve, shoot me an email.
Perhaps the answer will make it into this section. :)
如果你又不能解决的问题,给我发个电邮。也许答案会被加到这一节里。
Appendices
附录
===============================================================================
=== Appendix A: Striping swap space without RAID 0 ===
附录A:不用RAID 0来交替储存交换空间
For completeness' sake, I should mention that swap space can be striped to
improve performance without creating a RAID 0 array.
为了完整性,我应该阐明不需要RAID 0阵列也可以做到交替储存交换空间。
To accomplish this, start by forgetting about any instructions having to do
with /dev/md1, which would be our swap array - create the swap partitions on
the hard drives, but do not create this particular array.
为了做到这点,先不要管关于/dev/md1(我们的交换阵列)的指令 - 在硬盘上建立交换分区,但是不要建立这个阵列。
When creating the swap partitions, ensure that the partition type is set to
Linux Swap (type 82).
当建立交换分区时,确保分区类型是Linux Swap (type 82)。
During setup, the installer will recognize the swap partitions. Ensure that
all of them are selected, and continue as normal.
在安装过程中,安装程序会识别交换分区。确保所有的分区都被选上。如常继续。
After installation is complete, go ahead and boot your system - we can
finish this once the system is booted, in the interest of simplicity.
安装完成后,重启系统 - 重启后我们就可以完成安装了。
When the system boots, edit /etc/fstab with your favorite editor. Find the
lines that describe your swap partitions - they say "swap" in the second
column.
系统启动后,编辑/etc/fstab。找到描述你的交换分区的那些行 - 第二列是"swap"的哪些。
Each of these lines says "default" in the fourth column. Simply change that
to "default,pri=0" for each line.
每一行的第四列都是“default”。把它们都改成“default,pri=0”。
After saving the file, either reboot, or simply run:
保存文件后,要么重启,要么只要运行:
swapoff -a
swapon -a
To confirm that the setting has taken effect, you can run:
可以运行一下来确认设置生效了:
swapon -s
Verify that the Priority column reads 0 for each partition, and we're done!
检查每个分区的Priority列都是0,就完成了!
Acknowledgements/References
感谢/参考书目
===============================================================================
- In depth explanation of RAID levels:
"LasCon Storage - Different types of RAID"
http://www.lascon.co.uk/d008005.htm
- Thanks to John Jenkins (mrgoblin) for some tips in:
"Installing with Raid on Slackware 12.0+"
http://www.userlocal.com/articles/raid1-slackware-12.php
- Thanks to Karl Magnus Kolst?(karlmag) for his original writeup on
Slackware and RAID, ages ago!
"INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON A SOFTWARE
RAID level 0 DEVICE"
http://www.userlocal.com/articles/raid0-slackware-linux.php
- Of course, thanks to Patrick "The Man" Volkerding for creating Slackware!
http://slackware.com/
- Also thanks to the rest of the guys that proofread, tested, and suggested!
Eric Hameleers (alienBOB), Robby Workman, Alan Hicks,
Piter Punk, Erik Jan Tromp (alphageek)...
- My contact info:
作者联系方法:
Primary email: amrit@slackware.com
Secondary email: amrit@transamrit.net
On certain IRC networks: "amrit" (or some variation :) )
- This latest version of this document can be found at:
最新版本位于:
http://slackware.com/~amrit/
http://transamrit.net/docs/slackware/
Labels:
12.1,
bootloader,
initrd,
Linux,
RAID,
Slackware,
translation,
汉化,
翻译
Sunday, May 11, 2008
Friday, May 9, 2008
Slackware 12.0 to 12.1 Upgrade HOWTO Chinese Translation
Slackware 12.0 to 12.1 Upgrade HOWTO
Slackware 12.0 到 12.1 升级指南
This document explains how to upgrade from Slackware 12.0 to Slackware 12.1.
这篇文章是Slackware 12.0 到 12.1的升级说明。
----------------------------------------------------------------------------
For details of important changes from Slackware 12.0 to 12.1, see the file
'CHANGES_AND_HINTS.TXT'. Thanks to Robby Workman for help with this.
关于从Slackware 12.0 到 12.1的重大变化,请参考CHANGES_AND_HINTS.TXT。感谢Robby Workman在这上的帮助。
Before you begin, I would strongly recommend making a backup of your
system, or, if not the entire system, at least the /etc directory. You
might find that you need to refer to a few things after the upgrade
process is complete. Back it up, or take your chances.
开始之前,我强烈建议你备份你的系统。就算不备份整个系统,至少要备份/etc目录。因为升级完成后你可能需要查(目录)里的一些东西。要么备份要么博一下。
OK, now that everything is safely backed up, let's proceed. :-)
好了,如果都备份好了,就开始吧。
To do this, you'll need the Slackware 12.1 packages. If these are on a CD,
create a new directory to mount the CD on so that it doesn't get in the way
during the upgrade:
升级需要Slackware 12.1 的软件包。如果它们在CD上,建一个新目录来挂载CD,以免它们在升级过程中碍事。
mkdir /packages
mount /dev/cdrom /packages
The packages don't have to be on a CD-ROM, as an alternative you could
copy the slackware directory (the one with the various package
subdirectories in it, basically the "slackware" directory from the install
CD) to someplace like /root/slackware/. The important thing is that you
know where the slackware packages directory is. We'll use /root/slackware
in the following examples.
软件包不一定要在CD-ROM上。另一个方法是把slackware目录拷贝到某个地方,比如/root/slackware/。你需要知道软件包的目录在哪里。在以下的例子中我们假设是/root/slackware。
0. Put your machine in single-user mode:
0. 让你的机器进单用户模式:
telinit 1
1. Upgrade your glibc shared libraries. This is important, or things
might go haywire during the first part of the upgrade:
1. 升级glibc共享库。这很重要。不然的话第一部分的升级会搞糟:
upgradepkg /root/slackware/a/glibc-solibs-*.tgz
2. Upgrade your package utilities:
2. 升级软件包管理工具:
upgradepkg /root/slackware/a/pkgtools-*.tgz
3. Upgrade everything else (and install new packages):
3. 升级其他所有的软件包 (包括安装新的软件包):
upgradepkg --install-new /root/slackware/*/*.tgz
If you wish to upgrade everything except for the KDEI language
packs for KDE (these take a lot of space and can be dealt with
after the main upgrade more quickly and easily), running this
script in the "slackware" directory will do the trick:
如果你想要升级除了KDEI语言包(这些会用掉很多空间,而且系统升级完成后升级它们很容易)之外的所有软件包的话,在slackware目录下运行这个脚本:
#!/bin/sh
for dir in a ap d e f k kde l n t tcl x xap y ; do
( cd $dir ; upgradepkg --install-new *.tgz )
done
4. Make sure your system will boot. First, be sure your initrd is up
to date (if you use one). If you use LILO, make sure the paths in
/etc/lilo.conf point to a valid kernel and then type 'lilo' to
reinstall LILO. If you use a USB memory stick to boot, be sure to
copy the new kernel to it in place of the old one.
4. 确保你的系统可以引导进slackware。首先,确定你的initrd是最新的。如果你用LILO, 确保/etc/lilo.conf里的路径都指向有效的内核,然后打'lilo'重新安装LILO到引导区。如果你用USB闪存来引导,一定要把新内核拷贝过去覆盖旧的。
5. Remove obsolete packages. The CHANGES_AND_HINTS.TXT file should have a
list of these. You may also wish to go into /var/log/packages and take
a look at the package list:
5. 卸载已废弃的软件包。CHANGES_AND_HINTS.TXT里有一个列单。你也可以到/var/log/packages看一看:
ls -lt | less
You may spot some old, obsolete, or discontinued packages. If so,
you can remove these using 'removepkg'.
你可能会发现一些旧的,已废弃的,或者已停止支持的软件包。可以用'removepkg'卸载它们。
6. Fix your config files. Some of the config files in /etc are going to
need your attention. You'll find the new incoming config files on
your system with the ".new" extension. You may need to fill these in
with information from your old config files and then move them over.
6. 修正你的配置文件。需要注意/etc目录下的一些配置文件。新安装的配置文件以".new"为扩展名。你需要把旧的配置文件里的东西移到新的里面。
Feel brave? You can use this little script to install all of the
.new config files in /etc. If you've made any local changes you'll
need to add them to the newly installed files. Your old config files
will be copied to *.bak. Anyway, it might be an easier starting
point. Here it is:
如果你勇敢的话,可以用下面这个小脚本安装所有的.new配置文件。如果你以前改过某些配置文件的话,你要在新的配置文件里再做一遍你的改动。旧的配置文件会被备份成.bak扩展名。无论如何,可能这样做来开始比较容易。脚本如下:
#!/bin/sh
cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./group.new" \
-a ! "$configfile" = "./passwd.new" \
-a ! "$configfile" = "./shadow.new" ]; then
cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
$(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
mv $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
fi
done
7. If you use a non-en_US language pack for KDE and you already have it
installed, then you may upgrade it by moving into the slackware/kdei
directory and using this command:
7. 如果你已经安装使用了非美国英语的KDE语言包的话,可以进入slackware/kdei目录用下面这个命令升级它:
upgradepkg --install-new k**tgz
To have upgradepkg cycle through all of the available packages, and
see which ones need to be upgraded, use this in slakckare/kdei:
在slackware/kdei里用如下命令来升级所有需要升级的语言包:
upgradepkg *tgz
If your language has been added to KDE since Slackware 12.0, you'll
need to install it using installpkg, or upgradepkg --install-new.
如果你的语言是Slackware 12.0后才加入的。你要用installpkg,或者upgradepkg --install-new来安装它。
Typically you'll need to make sure that you have installed the
slackware/kdei packages for kde, koffice, and k3b (if you use those).
通常你要保证安装了kde, koffice, 和k3b的语言包(如果你有用它们的话)。
8. Return to multi-user mode:
8. 回到多用户模式:
telinit 3
At this point you should be running Slackware 12.1. :-)
到这里有已经在运行Slackware 12.1了 :-)
I wish everyone good luck with this!
我祝愿每个人升级时好运!
---
Patrick Volkerding
volkerdi@slackware.com
Slackware 12.0 到 12.1 升级指南
This document explains how to upgrade from Slackware 12.0 to Slackware 12.1.
这篇文章是Slackware 12.0 到 12.1的升级说明。
----------------------------------------------------------------------------
For details of important changes from Slackware 12.0 to 12.1, see the file
'CHANGES_AND_HINTS.TXT'. Thanks to Robby Workman for help with this.
关于从Slackware 12.0 到 12.1的重大变化,请参考CHANGES_AND_HINTS.TXT。感谢Robby Workman在这上的帮助。
Before you begin, I would strongly recommend making a backup of your
system, or, if not the entire system, at least the /etc directory. You
might find that you need to refer to a few things after the upgrade
process is complete. Back it up, or take your chances.
开始之前,我强烈建议你备份你的系统。就算不备份整个系统,至少要备份/etc目录。因为升级完成后你可能需要查(目录)里的一些东西。要么备份要么博一下。
OK, now that everything is safely backed up, let's proceed. :-)
好了,如果都备份好了,就开始吧。
To do this, you'll need the Slackware 12.1 packages. If these are on a CD,
create a new directory to mount the CD on so that it doesn't get in the way
during the upgrade:
升级需要Slackware 12.1 的软件包。如果它们在CD上,建一个新目录来挂载CD,以免它们在升级过程中碍事。
mkdir /packages
mount /dev/cdrom /packages
The packages don't have to be on a CD-ROM, as an alternative you could
copy the slackware directory (the one with the various package
subdirectories in it, basically the "slackware" directory from the install
CD) to someplace like /root/slackware/. The important thing is that you
know where the slackware packages directory is. We'll use /root/slackware
in the following examples.
软件包不一定要在CD-ROM上。另一个方法是把slackware目录拷贝到某个地方,比如/root/slackware/。你需要知道软件包的目录在哪里。在以下的例子中我们假设是/root/slackware。
0. Put your machine in single-user mode:
0. 让你的机器进单用户模式:
telinit 1
1. Upgrade your glibc shared libraries. This is important, or things
might go haywire during the first part of the upgrade:
1. 升级glibc共享库。这很重要。不然的话第一部分的升级会搞糟:
upgradepkg /root/slackware/a/glibc-solibs-*.tgz
2. Upgrade your package utilities:
2. 升级软件包管理工具:
upgradepkg /root/slackware/a/pkgtools-*.tgz
3. Upgrade everything else (and install new packages):
3. 升级其他所有的软件包 (包括安装新的软件包):
upgradepkg --install-new /root/slackware/*/*.tgz
If you wish to upgrade everything except for the KDEI language
packs for KDE (these take a lot of space and can be dealt with
after the main upgrade more quickly and easily), running this
script in the "slackware" directory will do the trick:
如果你想要升级除了KDEI语言包(这些会用掉很多空间,而且系统升级完成后升级它们很容易)之外的所有软件包的话,在slackware目录下运行这个脚本:
#!/bin/sh
for dir in a ap d e f k kde l n t tcl x xap y ; do
( cd $dir ; upgradepkg --install-new *.tgz )
done
4. Make sure your system will boot. First, be sure your initrd is up
to date (if you use one). If you use LILO, make sure the paths in
/etc/lilo.conf point to a valid kernel and then type 'lilo' to
reinstall LILO. If you use a USB memory stick to boot, be sure to
copy the new kernel to it in place of the old one.
4. 确保你的系统可以引导进slackware。首先,确定你的initrd是最新的。如果你用LILO, 确保/etc/lilo.conf里的路径都指向有效的内核,然后打'lilo'重新安装LILO到引导区。如果你用USB闪存来引导,一定要把新内核拷贝过去覆盖旧的。
5. Remove obsolete packages. The CHANGES_AND_HINTS.TXT file should have a
list of these. You may also wish to go into /var/log/packages and take
a look at the package list:
5. 卸载已废弃的软件包。CHANGES_AND_HINTS.TXT里有一个列单。你也可以到/var/log/packages看一看:
ls -lt | less
You may spot some old, obsolete, or discontinued packages. If so,
you can remove these using 'removepkg'.
你可能会发现一些旧的,已废弃的,或者已停止支持的软件包。可以用'removepkg'卸载它们。
6. Fix your config files. Some of the config files in /etc are going to
need your attention. You'll find the new incoming config files on
your system with the ".new" extension. You may need to fill these in
with information from your old config files and then move them over.
6. 修正你的配置文件。需要注意/etc目录下的一些配置文件。新安装的配置文件以".new"为扩展名。你需要把旧的配置文件里的东西移到新的里面。
Feel brave? You can use this little script to install all of the
.new config files in /etc. If you've made any local changes you'll
need to add them to the newly installed files. Your old config files
will be copied to *.bak. Anyway, it might be an easier starting
point. Here it is:
如果你勇敢的话,可以用下面这个小脚本安装所有的.new配置文件。如果你以前改过某些配置文件的话,你要在新的配置文件里再做一遍你的改动。旧的配置文件会被备份成.bak扩展名。无论如何,可能这样做来开始比较容易。脚本如下:
#!/bin/sh
cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./group.new" \
-a ! "$configfile" = "./passwd.new" \
-a ! "$configfile" = "./shadow.new" ]; then
cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
$(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
mv $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
fi
done
7. If you use a non-en_US language pack for KDE and you already have it
installed, then you may upgrade it by moving into the slackware/kdei
directory and using this command:
7. 如果你已经安装使用了非美国英语的KDE语言包的话,可以进入slackware/kdei目录用下面这个命令升级它:
upgradepkg --install-new k*
To have upgradepkg cycle through all of the available packages, and
see which ones need to be upgraded, use this in slakckare/kdei:
在slackware/kdei里用如下命令来升级所有需要升级的语言包:
upgradepkg *tgz
If your language has been added to KDE since Slackware 12.0, you'll
need to install it using installpkg, or upgradepkg --install-new.
如果你的语言是Slackware 12.0后才加入的。你要用installpkg,或者upgradepkg --install-new来安装它。
Typically you'll need to make sure that you have installed the
slackware/kdei packages for kde, koffice, and k3b (if you use those).
通常你要保证安装了kde, koffice, 和k3b的语言包(如果你有用它们的话)。
8. Return to multi-user mode:
8. 回到多用户模式:
telinit 3
At this point you should be running Slackware 12.1. :-)
到这里有已经在运行Slackware 12.1了 :-)
I wish everyone good luck with this!
我祝愿每个人升级时好运!
---
Patrick Volkerding
volkerdi@slackware.com
Labels:
12.0,
12.1,
Linux,
Slackware,
translation,
upgrade howto,
汉化,
翻译
Sunday, May 4, 2008
Saturday, May 3, 2008
Extenting a Logical Volume (non-RAID)
Create a new partition. e.g. /dev/sda9. Set the partition type to 8E (Linux LVM)
May need to reboot.
pvcreate /dev/sda9
vgextend datastore_vg0 /dev/sda9
lvextend -L80G /dev/datastore_vg0/download #80G is the target total size, not incremental size
resize_reiserfs -f /dev/datastore_vg0/download
May need to reboot.
pvcreate /dev/sda9
vgextend datastore_vg0 /dev/sda9
lvextend -L80G /dev/datastore_vg0/download #80G is the target total size, not incremental size
resize_reiserfs -f /dev/datastore_vg0/download
Thursday, May 1, 2008
Buring Files bigger than 4GB to DVD
Update2 (5 May 2009) - The issue below is fixed in k3b 1.63 (r948463) in slackware current and cdrtools-2.01.01a57.
Update - Issue: The DVDs burnt using K3B (and cdrtools) cannot be mounted with appropriate permissions using type udf. The permission is "d---------" when mounted. Mounting as iso9660 gives right permission.
After some trying, I finally managed to burn files bigger than 4GB to DVDs.
Required software:
cdrtools-2.01.01a38-i486-1 or later
k3b-1.0.4-i486-3 or later
From www.k3b.org k3b 1.0.4 Annoucement:
K3b now silently allows the burning of files bigger than 4 GB if an appropriate version of genisoimage or mkisofs is installed ("silently" means that I did not introduce any new messages)
Before start burning DVD, change the Filesystem Settings as follows: (see screenshot below)
- Check "Generate UDF structures"
- Select "Level 3" under "ISO Level"
Note if the settings are not appropriate, k3b will still go ahead to burn the DVD, but happily leave out the file that is more than 4GB and close the DVD, effectively wasting the DVD.
Update - Issue: The DVDs burnt using K3B (and cdrtools) cannot be mounted with appropriate permissions using type udf. The permission is "d---------" when mounted. Mounting as iso9660 gives right permission.
After some trying, I finally managed to burn files bigger than 4GB to DVDs.
Required software:
cdrtools-2.01.01a38-i486-1 or later
k3b-1.0.4-i486-3 or later
From www.k3b.org k3b 1.0.4 Annoucement:
K3b now silently allows the burning of files bigger than 4 GB if an appropriate version of genisoimage or mkisofs is installed ("silently" means that I did not introduce any new messages)
Before start burning DVD, change the Filesystem Settings as follows: (see screenshot below)
- Check "Generate UDF structures"
- Select "Level 3" under "ISO Level"
Note if the settings are not appropriate, k3b will still go ahead to burn the DVD, but happily leave out the file that is more than 4GB and close the DVD, effectively wasting the DVD.
Wednesday, March 5, 2008
Grub menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 15
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=1b579cb2-4e7b-4e97-8536-88595be8fb64 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,5)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## ## End Default Options ##
### END DEBIAN AUTOMAGIC KERNELS LIST
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
makeactive
chainloader +1
# Slackware 12.0 Huge SMP
title Slackware 12.0 Huge SMP
root (hd0,6)
kernel /boot/vmlinuz root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz
boot
# Slackware 12.0 Generic SMP
#title Slackware 12.0 Generic SMP
#root (hd0,6)
#kernel /boot/vmlinuz-generic-smp-2.6.21.5-smp root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz
boot
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.24-16-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet
title Ubuntu 8.04, kernel 2.6.22-14-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet
title Ubuntu 8.04, kernel 2.6.22-14-generic (recovery mode)
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro single
initrd /boot/initrd.img-2.6.22-14-generic
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 15
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=1b579cb2-4e7b-4e97-8536-88595be8fb64 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,5)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## ## End Default Options ##
### END DEBIAN AUTOMAGIC KERNELS LIST
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
makeactive
chainloader +1
# Slackware 12.0 Huge SMP
title Slackware 12.0 Huge SMP
root (hd0,6)
kernel /boot/vmlinuz root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz
boot
# Slackware 12.0 Generic SMP
#title Slackware 12.0 Generic SMP
#root (hd0,6)
#kernel /boot/vmlinuz-generic-smp-2.6.21.5-smp root=/dev/md0 ro vga=773
#initrd /boot/initrd.gz
boot
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.24-16-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet
title Ubuntu 8.04, kernel 2.6.22-14-generic
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet
title Ubuntu 8.04, kernel 2.6.22-14-generic (recovery mode)
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/md3 ro single
initrd /boot/initrd.img-2.6.22-14-generic
Thursday, August 23, 2007
Custom Font Config
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
default settings for all fonts.
-->
<match target="font" >
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hinting" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hintstyle" >
<const>hintmedium</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="antialias" >
<bool>true</bool>
</edit>
</match>
<!-- disable anti-alias for 8-17 size fonts -->
<match target="font" >
<test compare="contains" name="lang" qual="any">
<string>zh-cn</string>
<string>zh-sg</string>
<string>zh-tw</string>
<string>ja</string>
<string>ko</string>
</test>
<test compare="more_eq" name="pixelsize" qual="any" >
<double>8</double>
</test>
<test compare="less_eq" name="pixelsize" qual="any" >
<double>17</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
</match>
<!-- the space between English fonts is too wide,solve this problem -->
<match target="font">
<test name="lang" compare="contains" qual="any">
<string>zh-tw</string>
<string>zh-sg</string>
<string>zh-cn</string>
<string>ja</string>
<string>ko</string>
</test>
<edit name="spacing">
<const>proportional</const>
</edit>
<edit name="globaladvance">
<bool>false</bool>
</edit>
</match>
<!--
define the smallest size of Chinese fonts
-->
<match target="font" >
<test name="family" qual="any" >
<string>SimSun</string>
<string>NSimSun</string>
<string>SimHei</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL ZenKai Uni</string>
<string>AR PL New Sung</string>
</test>
<test compare="more_eq" name="pixelsize" >
<int>8</int>
</test>
<test compare="less_eq" name="pixelsize" >
<int>12</int>
</test>
<edit compare="eq" name="pixelsize" >
<int>12</int>
</edit>
</match>
<!--
sort the family of "serif ,sans,monospace",make it fit to Chinese people
-->
<alias>
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>Liberation Serif</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Times</family>
<family>Bitstream Vera Serif</family>
<family>DejaVu Serif</family>
<family>Simsun</family>
<family>MingLiu</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
<family>AR PL New Sung</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Arial</family>
<family>Verdana</family>
<family>Tahoma</family>
<family>Helvetica</family>
<family>Liberation Sans</family>
<family>Bitstream Vera Sans</family>
<family>DejaVu Sans</family>
<family>SimSun</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Courier New</family>
<family>Liberation Mono</family>
<family>Luxi Mono</family>
<family>Andale Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Nimbus Mono L</family>
<family>NSimSun</family>
<family>PMingLiu</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>Courier New</family>
<prefer>
<family>Courier New</family>
<family>Liberation Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Nimbus Mono L</family>
<family>Courier</family>
<family>Luxi Mono</family>
<family>Andale Mono</family>
<family>NSimSun</family>
<family>PMingLiu</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
</fontconfig>
Sunday, August 5, 2007
Enabling DRI for Intel 945G/GMA950
Update for Slackware 12.1
In Slackware 12.1, don't have to do all the changes in xorg.conf, except setting the driver to the right one (mine is "intel").
However, I observed some slowness in firefox in 12.1. After setting the following option for the intel driver, the problem goes away. Seems it is caused by the new acceleration method EXA, which is the default.
Option "AccelMethod" "XAA"
xorg的i810(或者新的intel)驱动支持945G/GMA950. 实际上,i810驱动支持所有这些intel chipset:
i810, i810-DC100, i810e, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM, 945G, 945GM
虽然man page里只提到915G和915GM。可以man i810看具体情况.
关键就是打开DRI. 我参照了以下文章。
http://dri.freedesktop.org/wiki/DriTroubleshooting
这篇文章很有帮助,告诉你如何一步一步确定DRI的问题的原因。建议有需要的看一看。
1. 我确定了我的内核(Slackware 12.0缺省huge smp内核)有Intel i810及以后芯片组的AGPGART和DRM的支持。
2. 我发现要在X里打开DRI.
编辑 xorg.conf
...
Section "Module"
...
# This loads the DRI module 载入DRI模块
Load "dri"
# This loads the GLX module 载入GLX模块
Load "glx"
...
EndSection
...
# 建一个用i810驱动的设备
Section "Device"
Identifier "i810"
Driver "i810"
# Alternative to Load "dri" 这个Option与Load "dri"等效
# Option "DRI" "true"
EndSection
...
# 使用i810设备
Section "Screen"
Identifier "Screen 1"
Device "i810"
Monitor "Samsung 710N"
...
# 让普通用户也可以使用DRI. 如果没有这个,只有root可以用。
Section "DRI"
Mode 0666
EndSection
之前:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No
server glx vendor string: SGI
x@slackx:~$ glxgears
4246 frames in 5.1 seconds = 840.647 FPS
4200 frames in 5.0 seconds = 835.972 FPS
4605 frames in 5.1 seconds = 901.136 FPS
4920 frames in 5.1 seconds = 961.904 FPS
5160 frames in 5.0 seconds = 1027.514 FPS
5160 frames in 5.0 seconds = 1027.391 FPS
5160 frames in 5.0 seconds = 1028.289 FPS
5160 frames in 5.0 seconds = 1028.484 FPS
5160 frames in 5.0 seconds = 1027.678 FPS
5173 frames in 5.0 seconds = 1027.146 FPS
...
重起X之后:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
x@slackx:~$ glxgears
7591 frames in 5.0 seconds = 1518.076 FPS
7774 frames in 5.0 seconds = 1554.788 FPS
17984 frames in 5.0 seconds = 3596.714 FPS
17536 frames in 5.0 seconds = 3507.012 FPS
17372 frames in 5.0 seconds = 3474.314 FPS
18021 frames in 5.0 seconds = 3604.041 FPS
In Slackware 12.1, don't have to do all the changes in xorg.conf, except setting the driver to the right one (mine is "intel").
However, I observed some slowness in firefox in 12.1. After setting the following option for the intel driver, the problem goes away. Seems it is caused by the new acceleration method EXA, which is the default.
Option "AccelMethod" "XAA"
xorg的i810(或者新的intel)驱动支持945G/GMA950. 实际上,i810驱动支持所有这些intel chipset:
i810, i810-DC100, i810e, i815, 830M, 845G, 852GM, 855GM, 865G, 915G, 915GM, 945G, 945GM
虽然man page里只提到915G和915GM。可以man i810看具体情况.
关键就是打开DRI. 我参照了以下文章。
http://dri.freedesktop.org/wiki/DriTroubleshooting
这篇文章很有帮助,告诉你如何一步一步确定DRI的问题的原因。建议有需要的看一看。
1. 我确定了我的内核(Slackware 12.0缺省huge smp内核)有Intel i810及以后芯片组的AGPGART和DRM的支持。
2. 我发现要在X里打开DRI.
编辑 xorg.conf
...
Section "Module"
...
# This loads the DRI module 载入DRI模块
Load "dri"
# This loads the GLX module 载入GLX模块
Load "glx"
...
EndSection
...
# 建一个用i810驱动的设备
Section "Device"
Identifier "i810"
Driver "i810"
# Alternative to Load "dri" 这个Option与Load "dri"等效
# Option "DRI" "true"
EndSection
...
# 使用i810设备
Section "Screen"
Identifier "Screen 1"
Device "i810"
Monitor "Samsung 710N"
...
# 让普通用户也可以使用DRI. 如果没有这个,只有root可以用。
Section "DRI"
Mode 0666
EndSection
之前:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No
server glx vendor string: SGI
x@slackx:~$ glxgears
4246 frames in 5.1 seconds = 840.647 FPS
4200 frames in 5.0 seconds = 835.972 FPS
4605 frames in 5.1 seconds = 901.136 FPS
4920 frames in 5.1 seconds = 961.904 FPS
5160 frames in 5.0 seconds = 1027.514 FPS
5160 frames in 5.0 seconds = 1027.391 FPS
5160 frames in 5.0 seconds = 1028.289 FPS
5160 frames in 5.0 seconds = 1028.484 FPS
5160 frames in 5.0 seconds = 1027.678 FPS
5173 frames in 5.0 seconds = 1027.146 FPS
...
重起X之后:
x@slackx:~$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
x@slackx:~$ glxgears
7591 frames in 5.0 seconds = 1518.076 FPS
7774 frames in 5.0 seconds = 1554.788 FPS
17984 frames in 5.0 seconds = 3596.714 FPS
17536 frames in 5.0 seconds = 3507.012 FPS
17372 frames in 5.0 seconds = 3474.314 FPS
18021 frames in 5.0 seconds = 3604.041 FPS
Saturday, August 4, 2007
转载:让 xterm 与其它程序间复制粘贴更灵活
在 TERM 中选中文字“甲”,需鼠标中键贴入其它程序(如 firefox ),而此时在 firefox 里选中文字“乙”并不 Ctrl-c ,再用鼠标中键贴出,发现贴出“乙”,而“甲”不见了。
需要效果:在 TERM 中选中即可 Ctrl-v 贴入 firefox 一类的程序中,无需鼠标中键。而在 firefox 一类的程序中 Ctrl-c 复制后,鼠标不论再选中什么,在 TERM 中 Shift-Insert 出的依然是 Ctrl-c 的内容
在 Xwindow 里有一个选中缓冲(PRIMARY)和一个剪贴板(CLIPBOARD)
几乎除了 TERM 程序以外,没有还在用选中缓冲的程序
造成 TERM 中选中的,需要鼠标中键才能贴到其它程序里。在贴之前,在其它程序中还不能选中任何东西,一旦选中,选中缓冲就被刷新
a) xterm 功能强大,本身就带剪贴板功能,如下配置即可
在 $HOME/.Xresources 里如下写,可让 xterm 的复制进入剪贴板,不再过选中缓中
*VT100*translations: #override \n\
Shift Insert:insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift~Ctrl: insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift: select-end(CLIPBOARD, CUT_BUFFER1)
前两句是说当 Shift-Insert 与鼠标中键(Btn2UP)效果是贴出剪贴板内容
第三句是说当 鼠标左键(BtnUP)效果是复制给剪贴板
这样一来,在 firefox 中任意选中的文字(不 Ctrl-c ),不管是 Shift-Insert 还是鼠标中键都复制不出来了
*VT100*translations: #override \n\
Shift Insert:insert-selection(CLIPBOARD, CUT_BUFFER1) \n\
~Shift~Ctrl: insert-selection(PRIMARY, CUT_BUFFER0) \n\
~Shift: select-end(CLIPBOARD, CUT_BUFFER1) \n\
~Shift: select-end(PRIMARY, CUT_BUFFER0)
这样就让在 firefox 里随意选中的文字,鼠标中键可贴在 TERM 中,而 Ctrl-c 的内容由 Shift-Insert 贴出
当然配置是灵活的,随自己喜欢了。
b) rxvt, aterm, mrxvt, rxvt-unicode 系列,需要一点小修改
这一系列都是基于 rxvt 的,代码相近,下面以 rxvt-unicode 为例:
(无需会编程,不过是替换游戏,把选中缓冲替换为剪贴板)
原理:把选中缓冲(XA_PRIMARY)换成剪贴板(xa[XA_CLIPBOARD])即可
vi rxvt-unicode-8.1/src/screen.C
2895 行:
if (selnum == Sel_Primary)
sel = xa[XA_CLIPBOARD];
else if (selnum == Sel_Secondary)
sel = XA_SECONDARY;
else
sel = XA_PRIMARY;
3066行:
XSetSelectionOwner (dpy, xa[XA_CLIPBOARD], vt, tm);
if (XGetSelectionOwner (dpy, xa[XA_CLIPBOARD]) == vt)
From: http://bbs.linuxsir.org/showthread.php?t=290883
需要效果:在 TERM 中选中即可 Ctrl-v 贴入 firefox 一类的程序中,无需鼠标中键。而在 firefox 一类的程序中 Ctrl-c 复制后,鼠标不论再选中什么,在 TERM 中 Shift-Insert 出的依然是 Ctrl-c 的内容
在 Xwindow 里有一个选中缓冲(PRIMARY)和一个剪贴板(CLIPBOARD)
几乎除了 TERM 程序以外,没有还在用选中缓冲的程序
造成 TERM 中选中的,需要鼠标中键才能贴到其它程序里。在贴之前,在其它程序中还不能选中任何东西,一旦选中,选中缓冲就被刷新
a) xterm 功能强大,本身就带剪贴板功能,如下配置即可
在 $HOME/.Xresources 里如下写,可让 xterm 的复制进入剪贴板,不再过选中缓中
*VT100*translations: #override \n\
Shift
~Shift~Ctrl
~Shift
前两句是说当 Shift-Insert 与鼠标中键(Btn2UP)效果是贴出剪贴板内容
第三句是说当 鼠标左键(BtnUP)效果是复制给剪贴板
这样一来,在 firefox 中任意选中的文字(不 Ctrl-c ),不管是 Shift-Insert 还是鼠标中键都复制不出来了
*VT100*translations: #override \n\
Shift
~Shift~Ctrl
~Shift
~Shift
这样就让在 firefox 里随意选中的文字,鼠标中键可贴在 TERM 中,而 Ctrl-c 的内容由 Shift-Insert 贴出
当然配置是灵活的,随自己喜欢了。
b) rxvt, aterm, mrxvt, rxvt-unicode 系列,需要一点小修改
这一系列都是基于 rxvt 的,代码相近,下面以 rxvt-unicode 为例:
(无需会编程,不过是替换游戏,把选中缓冲替换为剪贴板)
原理:把选中缓冲(XA_PRIMARY)换成剪贴板(xa[XA_CLIPBOARD])即可
vi rxvt-unicode-8.1/src/screen.C
2895 行:
if (selnum == Sel_Primary)
sel = xa[XA_CLIPBOARD];
else if (selnum == Sel_Secondary)
sel = XA_SECONDARY;
else
sel = XA_PRIMARY;
3066行:
XSetSelectionOwner (dpy, xa[XA_CLIPBOARD], vt, tm);
if (XGetSelectionOwner (dpy, xa[XA_CLIPBOARD]) == vt)
From: http://bbs.linuxsir.org/showthread.php?t=290883
Setting up Chinese in Slackware 12
Update: With Slackware 12.1, Chinese display works out-of-the-box with 文泉驿 (WenQuanYi) 正黑 font. IME packages like scim, skim and a lot more are included in 12.1, Chinese (and other language) input can be enabled easily by following instructions in CHANGES_AND_HINTS.TXT in the distribution.
Objective
- Allow displaying of Chinese characters in UTF-8 encoding while still having the normal English user interface.
- Allow inputing of Chinese characters using SCIM.
Environment
Slackware 12.0 full installation, default 2.6.21.5 huge smp kernel.
文泉驿 (WenQuanYi) Bitmap Song font 0.8.1
scim 1.4.7, scim-pinyin-0.5.91, skim-1.4.5
Display
Get 文泉驿 (WenQuanYi) Bitmap Song font from http://wqy.sourceforge.net/. I use the PCF format of current version 0.8.1. Follow the instructions included in the downloaded file (run mkfontdir, vc-cache, etc). I copied all the pcf files into /usr/share/fonts/ folder, so that no change to /etc/X11/xorg.conf and /etc/fonts/fonts.conf is required. You can also copy the file 85-wqy-bitmapsong.conf into /etc/fonts/conf.avail/ and created a link in /etc/fonts/conf.d/, as suggested by the installation instructions but with slight variation in directory names. However, this config file will force WenQuanYi to be the chosen for all kinds of font requests, and make your English contents ugly. So if you want beautiful English fonts, don't use this one, and do your own font config instead.
As I still want to use English as my primary desktop language, I leave the LC_* environment variables untouched, and only changed LC_CTYPE=zh_CN.UTF-8 in my ~/.profile. (Note: I tried en_US.utf8 but it does not work, as all KDE applications will show squares for Chinese characters. This means fontconfig does not pick WenQuanYi font. I guess the reason is because WenQuanYi Bitmap Song font's lang attribute does not have "en" in the list so it does not get matched. )
After that restart X.
Input
Download and compile scim, scim-pinyin, and skim, using root.
scim 1.4.7
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-1.4.7-i686-1xc.tgz
installpkg scim-1.4.7-i686-1xc.tgz
scim-pinyin 0.5.91
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-pinyin-0.5.91-i686-1xc.tgz
installpkg scim-pinyin-0.5.91-i686-1xc.tgz
skim 1.4.5
scons configure prefix=/usr
scons -j3
mkdir -p/usr/lib/pkgconfig
cp skim.pc/usr/lib/pkgconfig/
scons install DESTDIR=/your/dest
makepkg skim-1.4.5-i686-1xc.tgz
installpkg skim-1.4.5-i686-1xc.tgz
I also added the following lines to .profile:
export XMODIFIERS=@im=SCIM
export XIM=SCIM
export XIM_PROGRAM=SCIM
After that restart X.
Objective
- Allow displaying of Chinese characters in UTF-8 encoding while still having the normal English user interface.
- Allow inputing of Chinese characters using SCIM.
Environment
Slackware 12.0 full installation, default 2.6.21.5 huge smp kernel.
文泉驿 (WenQuanYi) Bitmap Song font 0.8.1
scim 1.4.7, scim-pinyin-0.5.91, skim-1.4.5
Display
Get 文泉驿 (WenQuanYi) Bitmap Song font from http://wqy.sourceforge.net/. I use the PCF format of current version 0.8.1. Follow the instructions included in the downloaded file (run mkfontdir, vc-cache, etc). I copied all the pcf files into /usr/share/fonts/ folder, so that no change to /etc/X11/xorg.conf and /etc/fonts/fonts.conf is required. You can also copy the file 85-wqy-bitmapsong.conf into /etc/fonts/conf.avail/ and created a link in /etc/fonts/conf.d/, as suggested by the installation instructions but with slight variation in directory names. However, this config file will force WenQuanYi to be the chosen for all kinds of font requests, and make your English contents ugly. So if you want beautiful English fonts, don't use this one, and do your own font config instead.
As I still want to use English as my primary desktop language, I leave the LC_* environment variables untouched, and only changed LC_CTYPE=zh_CN.UTF-8 in my ~/.profile. (Note: I tried en_US.utf8 but it does not work, as all KDE applications will show squares for Chinese characters. This means fontconfig does not pick WenQuanYi font. I guess the reason is because WenQuanYi Bitmap Song font's lang attribute does not have "en" in the list so it does not get matched. )
After that restart X.
Input
Download and compile scim, scim-pinyin, and skim, using root.
scim 1.4.7
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-1.4.7-i686-1xc.tgz
installpkg scim-1.4.7-i686-1xc.tgz
scim-pinyin 0.5.91
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-pinyin-0.5.91-i686-1xc.tgz
installpkg scim-pinyin-0.5.91-i686-1xc.tgz
skim 1.4.5
scons configure prefix=/usr
scons -j3
mkdir -p
cp skim.pc
scons install DESTDIR=/your/dest
makepkg skim-1.4.5-i686-1xc.tgz
installpkg skim-1.4.5-i686-1xc.tgz
I also added the following lines to .profile:
export XMODIFIERS=@im=SCIM
export XIM=SCIM
export XIM_PROGRAM=SCIM
After that restart X.
Friday, August 3, 2007
Sample .bashrc
# Set the following to make all x terminals have proper PS1 and PS2
# \033[0;30m - Black
# \033[0;31m - Red
# \033[0;32m - Green
# \033[0;33m - Orange
# \033[0;34m - Blue
# \033[0;35m - Cyan
# \033[0;36m - Light Blue
# \033[0;37m - Grey
# \033[0;39m - White
export PS1='\u@\h:\w\$'
export PS2='> '
# Below sets the titlebar of the terminal windows
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# Display fortune for each new terminal session, and enable colors in ls output
for profile_script in '/etc/profile.d/bsd-games-login-fortune.sh' '/etc/profile.d/coreutils-dircolors.sh' ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script
# \033[0;30m - Black
# \033[0;31m - Red
# \033[0;32m - Green
# \033[0;33m - Orange
# \033[0;34m - Blue
# \033[0;35m - Cyan
# \033[0;36m - Light Blue
# \033[0;37m - Grey
# \033[0;39m - White
export PS1='\u@\h:\w\$'
export PS2='> '
# Below sets the titlebar of the terminal windows
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# Display fortune for each new terminal session, and enable colors in ls output
for profile_script in '/etc/profile.d/bsd-games-login-fortune.sh' '/etc/profile.d/coreutils-dircolors.sh' ; do
if [ -x $profile_script ]; then
. $profile_script
fi
done
unset profile_script
Subscribe to:
Posts (Atom)