Logical Volume Manager Cheatsheet
Today I got a new harddisk, so it was finally time for me to have an in depth look at LVM. I use it to combine two harddisks /dev/sdg1 and /dev/sdb1 into one volume group ext_vg which contains one big logical volume /dev/ext_vg/ext. In short, my 250GB and 500GB harddisks are used in one big 750GB ext3 mount point.
I followed the excellent LVM Tutorial, and was surprised how easy everything goes. Here is a short cheat sheet of the important commands (take care to exchange the partition/volume names if you use this):
Installation
I use Ubuntu, so this is a piece of cake:
sudo apt-get install lvm2
There is also a GUI available, but I found the command line tools are very easy to use so there is no real need. I wouldn’t use EVMS as it is not supported in Ubuntu 7.10 and may cause problems.
Create a New Filesystem
First I create the physical volume on the partition sdg1, create a new volume group ext_vg that contains this physical volume, and create a new logical volume of size 450GB within the volume group. Finally create the filesystem (disabled reservation space, see Get More Space Out of Your ext3 Partition).
sudo pvcreate /dev/sdg1 sudo vgcreate ext_vg /dev/sdg1 sudo lvcreate -L 450G -n ext ext_vg sudo mkfs.ext3 -m 0 /dev/ext_vg/ext
Show Status
Each LVM layer has its corresponding command to get information about the metadata:
sudo pvdisplay sudo vgdisplay sudo lvdisplay sudo pvs sudo vgs sudo lvs
Mount via fstab
I use the filesystem mainly for data, so allowing just rw is enough (no executables allowed). noatime allows quicker access.
sudo mkdir /media/mega /dev/ext_vg/ext /media/mega ext3 rw,noatime,user 0 2 mount /media/mega
Resize
It is even possible to do an online resize of the system, wohoo
This extends the logical volume by 200MB.
sudo lvextend -L +200 /dev/ext_vg/ext sudo resize2fs -p /dev/ext_vg/ext
You can watch the resize process going on with df -h.
Add Another Partition to the Logical Volume
To add another partition and use up all the available space in the logical volume, first add the physical volume to the volume group, then use pvdisplay to find out the total available number of free PE (add the numbers from the physical volumes), then use lvextend to use up all this available space.
sudo pvcreate /dev/sdb1 sudo vgextend ext_vg /dev/sdb1 sudo pvdisplay sudo lvextend -l +63602 /dev/ext_vg/ext sudo resize2fs /dev/ext_vg/ext
That’s it! Any questions? please post.
Howto Get Enough Sleep Despite StumbleUpon with Ubuntu
What?
I am a long-term StumbleUpon user, which means that I don’t get much sleep. Now, after almost 4 years of stumbling, I have decided to get my life back. Well, at least some sleep!
What does this do?
Every night when I have to work on the next day (Sunday night to Thursday night ), at 23:25 my computer shows me this little warning message:

After the 5 minutes have passed, the computer shuts itself automatically down.
I use this little trick with Ubuntu, but it should work anywhere where Gnome is installed.
How?
Thanks to the power of Linux, this is not difficult to do for yourself, and configure it however you want it to behave:
- Open /etc/crontab with your favourite text editor (no need for crontab -e since this is the system wide crontab), e.g.
sudo gedit /etc/crontab
- Add the following lines (replace manker with your username!)
25 23 * * 0-4 manker /usr/bin/zenity --display :0 --warning --text="Shutdown in 5 minutes. Go to bed." 25 23 * * 0-4 root shutdown -h +5
- The first part of both lines 25 23 * * 0-4 means that the commands are executed at 23:25, but only Sunday (day 0) to Thursday (day 4). Read man 5 crontab for a detailed description of that format.
- The first command uses zenity to show a warning message. You have to execute this as the same user that you use for working, or you will not see the message, so change manker to your username (root does not work either).
- The second command shutdown -h +5 means that the computer will halt in 5 minutes. This has to be run as root, and it also shows nice warning messages in all your open terminals so you can’t really miss it.
- Save the file, and stumble until it is 23:25.
Sweet dreams!
Get More Space Out of Your ext3 Partition
I have just discovered that ext3 defaults to reserving 5% of its partition exclusively for root, as a precaution measure that your system does not get FUBAR when you use it for your root partition. I have a 230GB external USB disk that I use for all my big storage requirements, downloaded stuff, backups etc. Due to this reservation I had 11.5GB of unusable disk space, thankfully this is easy to fix:
tune2fs -m 0 /dev/sdf1
Replace sdf1 with your partition name. You don’t even have to unmount your disk. Voilá, 11.5 GB more space for free
Here is the output of df -h as proof:
Before:
Filesystem Size Used Avail Use% Mounted on /dev/sdf1 230G 193G 26G 89% /media/disk
After:
Filesystem Size Used Avail Use% Mounted on /dev/sdf1 230G 193G 38G 84% /media/disk
If you like this, you might also be interested in How to change Ubuntu forced fsck.
Update: The free space limitation is also used to prevent fragmentation. So if you set the limit to zero and operate on a very full harddisk for a while, your filesystem might slow down.
Major Clearlooks Compact Update
The Clearlooks Compact theme was released just a few days ago, and it already is the highest rated theme at gnome-look.org, out of more than a thousand. I guess the compactness really hit the nerve of lots of Linux users.
This encouraged me to do some further updates, I have incorporated lots of several tips and from the post “Making Eclipse look good on Linux“. The result is a very compact theme that does not waste space if possible.
Hope you like it as much as I do
Clearlooks Compact Gnome Theme
I have been using Ubuntu for quite a while now, but one thing I really dislike is that all the themes are huge space wasters compared to Windows XP. This finally got me angry enough to create a customized version of the Clearlooks theme that tries to be very compact but still maintain its beautiful look. I like the result quite a lot, I have been using this theme for more than two weeks now and it works great. It is especially nice for intense applications like Eclipse.
UPDATE: Human Compact Theme for Ubuntu 8.10 (Intrepid Ibex) is available!
Comparison
Move your mouse over the image to see how the dialog looks like with clearlooks-compact. The buttons and spacing are smaller, which results in much more visible space for the actual content.
More Screenshots
Here are some more screenshots that I have taken with Clearlooks Compact enabled. Especially the Eclipse shot is great, there the theme really shines. It is even more compact than the Windows XP look.
If you are curious, I have used Tahoma, size 9 for the application font, and the MiscFixed for the sourcecode.
Download & Installation
Installation is extremely simple, in Ubuntu 7.10 (Gutsy Gibbon) you can do it this way:
- Click System > Preferences > Appearance.
- Drag & drop the link ClearlooksCompact-1.5.tar.bz2 into the Appearence window.
Beware that this is just definition of the Clearlooks control spacings. That means you have to have the clearlooks engine installed (which you most likely have, it is the default theme of Ubuntu). To change back, click on the currently active Theme, choose “Customize”, and select other controls instead of “Clearlooks Compact”.
History
I will regularly update this page when I update the theme with a new screenshot and the development history:
- April 9th, 2009
- Version 1.5: a bit smaller checkbox + selection box, less blurry and smaller progress bar.
- April 5th, 2009
- Version 1.4: added LGPL, index.theme, version number.
- April 11th, 2008
- Version 1.3: Small panel menu
- November 11th, 2007
- Version 1.2: Major update: Smaller handlers sizes, smaller scrollbars, no scrollbar spacing, less overall padding, and some more.
- November 7th, 2007
- Version 1.1: Now even more compact by reducing the default icon size to 16×16 pixels.
- November 4th, 2007
- Version 1.0: First release of Clearlooks Compact.