Home » Archive by category "Linux"

Entropy

I was working on a Debian 5 (Lenny) box and needed to generate a key.
So, ok, let’s do gpg –gen-key , filled in the required info, and let’s generate that key, when, suddenly:

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++++++++++++++++++.+++++++++++++++++++++++++.+++++…++++++++++..+++++..++++++++++.+++++.++++++++++>+++++………….+++++

Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 258 more bytes)

What? What entropy? Do what? Use the keyboard, disk ?
Well, apparently, there is no joke, you really need some activity going on the system in order to generate the key.

I did ls -R / and it started to generate the key.

To see the entropy of the system: cat /proc/sys/kernel/random/entropy_avail

Now I wonder, do we have entropy on Windows?

How to resize LVM (extend or reduce)

Logical Volume Manager is great, you can manage your disks and partitions in volumes. The most common task is to extend a volume or reduce one.

You can extend a volume while the system is running, which is preaty great. Here’s how:

1. Let say your physical disk is /dev/sda, you already have two partitions (/dev/sda1 and /dev/sda2) and want to extend the rest of the free space. fdisk /dev/sda and create a new partition /dev/sda3

2.  pvcreate /dev/sda3

3.  vgextend VolGroup00 /dev/sda3

4.   lvextend /dev/VolGroup00/LogVol00 /dev/sda3

5.   resize2fs /dev/VolGroup00/LogVol00

Now, asume that we want to reduce. This is a little bit tricky, you can not do it on the fly. You have to boot with a rescue cd (can be CentOS cd1 and type linux rescue at prompt).

1. lvm vgchange -a y

2. e2fsck -f /dev/VolGroup00/LogVol00

3. resize2fs -f /dev/VolGroup00/LogVol00 20G

4. lvm lvreduce -L10G /dev/VolGroup00/LogVol00

Happy resizing !