August 2010

Resizing Logical Volumes

I recently started moving from Fedora 9 to Ubuntu 10.04. Both file systems live in logical volumes. Fedora 9 is in /dev/VolGroup00/fedora9-root (10G) and /dev/VolGroup00/fedora9-home (75G) and Ubuntu 10.04 is in /dev/VolGroup00/ubuntu-10.04-root (10G) and /dev/VolGroup00/ubuntu-10.04-home (52G).

My migration strategy is to leave Fedora alone for the rest of the family and use the new Ubuntu installation myself until I’m confident everything is set up correctly. I’ve been moving things from my Fedora home to my Ubuntu home as I need them. Unfortunately, I’ve run out of room on the Ubuntu home logical volume and there’s no more room on the LVM or physical disks.

I need to shrink the Fedora home and expand the Ubuntu home. A nice summary of the commands used here is on Fedora Daily Package.

First, I need to know how much space I can grab from the Fedora home:

$ sudo mount /mnt/fedora9-home
$ df -h /mnt/fedora9-home
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-fedora9--home
                       74G   29G   42G  41% /mnt/fedora9-home
$ sudo umount /mnt/fedora9-home

This tells me the file system needs 29G and there’s 42G available. Since it’s still being used, I don’t want to take all the space, so I’ll leave a few gigabytes. I’ll make it 32G, freeing up 39G. To make all these changes to the file systems, they can’t be mounted. Use the Ubuntu 10.04 Alternate installation disc, which supports LVM. When booting, choose “Rescue a broken system”, tell it not to use a root file system and run a shell in the installer environment.

Activate the logical volumes:

# lvm vgscan
# lvm vgchange -ay

Check the LVM sizes:

# lvm lvs

Shrink Fedora home:

# e2fsck -f /dev/VolGroup00/fedora9-home
# resize2fs /dev/VolGroup00/fedora9-home 31G
# lvm lvresize VolGroup00/fedora9-home --size 32G
# resize2fs /dev/VolGroup00/fedora9-home

This sequence makes sure nothing gets clipped by rounding. The file system is shrunk to 31G, then the volume is resized to 32G. Lastly, the file system is resized to use all the space in the volume.

Now add the space to Ubuntu home:

# lvm lvresize VolGroup00/ubuntu-10.04-home --size 91G
# resize2fs /dev/VolGroup00/ubuntu-10.04-home
# e2fsck /dev/VolGroup00/ubuntu-10.04-home

Uncategorized

Comments (0)

Permalink

Firefox Wierdness

On Boon (Ubuntu 10.04 64), Firefox started behaving oddly two days ago. This is a new installation of Ubuntu, but it was originally working fine. The symptoms are:

  • Delicious add-on is missing from the main menu
  • Copy, Cut and Paste keyboard shortcuts don’t work
  • Tab doesn’t move between fields

I was all kinds of confused. Finding what happened took quite a long time. The first thing I noticed was the missing menu item. I use Delicious constantly and I’m keyboard biased, so this I noticed right away. After using the toolbar icon, I noticed none of my bookmarks were there. The other two symptoms I noticed shortly after. It was initially hard to believe what I was experiencing and didn’t put it together that these things were related. I tried tab in other applications and found that worked. That narrowed it down to a Firefox problem. A web search found a report of a problem with the Delicious add-on. There’s no fix yet, but the work arounds are to either disable the add-on or load an older version, which is what I did.

Uncategorized

Comments (0)

Permalink

Changing OS Name in Grub 2 Menu

Since upgrading Boon to Ubuntu 10.04, I’ve been running the new Grub 2 boot loader. It looks much like the old grub, but the configuration is very different. On installation, it found all the operating systems installed on Boon, including the Gateway recovery partition, which is labeled “Windows Vista (loader) (on /dev/sdb1)”. Unfortunately, the Vista installation was labeled “Windows Vista (loader) (on /dev/sdb2)”. Since sdb1 was listed first, my wife chose this and ended up very much not where she wanted to be.
With Grub 1 (a.k.a. Grub Legacy), I’d have edited the menu entry title in /boot/grub/menu.lst and been done with it. Now the configuration file is named /boot/grub/grub.cfg and warns “DO NOT EDIT THIS FILE.” No problem, but where am I supposed to make the change?
I started with the Ubuntu Wiki Grub 2 instructions. From there, I found out how grub.cfg is created and how to exclude entries or add custom ones, but nothing specifically about how to change the title of a menu entry. I suppose I could edit /etc/grub.d/30_os-prober manually, but with all this talk of Grub 2′s increased flexibility, I suspect there’s a better way.
Next, I checked out the Grub 2 Community Ubuntu Documentation. Not much there. Maybe I’m too optimistic, but I don’t see the average user editing shell scripts to change his boot menu. But it seems that’s what I have to do.
I want to preserve the original script and work with a copy:
sudo cp /etc/grub.d/30_os-prober /etc/grub.d/31_os-prober-custom
sudo chmod -x /etc/grub.d/30_os-prober
The mode change prevents the original from running and producing duplicate entries. Next, edit /etc/grub.d/31_os-prober-custom:
Find

  case ${BOOT} in
    chain)

and change the lines after that from:

      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF

to:

      case ${DEVICE} in 
	/dev/sdb1)
        cat << EOF
menuentry "Gateway Recovery (on ${DEVICE})" {
EOF
	;;
	*)
        cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
        ;;
      esac

Of course, this is specific to my installation. What the code change does is alter the label for anything on /dev/sdb1 to "Gateway Recovery". Since there can be only one OS per partition and I'm not moving the recovery partition, this is fine.
To make the changes stick, run sudo update-grub.
BTW, if you're using an editor such as Emacs that makes backup copies, don't worry about the backups. update-grub is smart enough to exclude them. I mention this only because this was a problem with a script from an older distribution that handled events on my Laptop. Since the original script and the backup got run, closing the laptop lid caused two instances of the event to run. The laptop would hibernate, then when the lid was opened, it would wake up and immediately hibernate again.

Uncategorized

Comments (0)

Permalink

Starting Applications in Ubuntu on Log In

This morning I realized the first thing I do almost all the time when I log in to the laptop is open Firefox. I don’t do this on the desktop because I tend to do other work there. But on the laptop, it’s almost always checking mail or some other web browsing. In the past, I’ve set this up and always undid it, as frequently, this wasn’t what I logged in for and, in the past, waiting for the browser to load was an annoyance. However, machines are faster now and (on the laptop, at least) I’m spending more of my computer time on line. So let’s give it a shot again.
I hunted through the System -> Preferences menu and found Startup Applications. On the second tab, “Options”, there’s a button labeled “Remember Currently Running Application”. I pressed it, logged out and logged back in. No Firefox.
I don’t know why this didn’t work, and given that, I don’t know what that button’s supposed to do, but it appears that you’re supposed to add the application to the first tab “Startup Programs”. I added Firefox (/usr/bin/firefox). It was selected by default. Log out and log in, et viola, a browser window.

Uncategorized

Comments (0)

Permalink

Ubuntu 10.04 LTS Install on Boon

Boon (the desktop) is running Fedora 9, which is out of date. Ubuntu has been running nicely on the Thinkpad for some time, so I´d like to upgrade to that.

The first step is to take a look at the disk space for a place to put it. Luckily, I´ve got an old unused /boot partition, so I can use that. I’ve learned from past mistakes that sharing a boot partition between different distributions is a mistake. Thinking they’re upgrading, they tend to uninstall older kernels still being used.

I have Logical Volume Management installed to take advantage of flexible partitioning and drive striping. There’s enough space on the LVM for the new install, so that’s no problem.

I grabbed the Ubuntu 10.04 LTS Desktop ISO from Ubuntu.com and burned the CD. After booting the install disk, the installation can’t see the LVM. A quick check on-line turns up the problem. In order to use LVM, you need either the Alternate or Server install disks, which don’t have an install GUI. I burned the Alternate disk and started the install. I chose Ext4 journaling file systems for /, /boot, and /home and put Grub on the /boot partition /dev/sda3. Unfortunately, this isn’t the boot device for the drive, so I can’t run anything other than my old installations. I boot into the old Fedora installation and see where Grub was installed and update it. I hit another snag. Fedora 9 can’t read Ext4. Plan B is to boot the Ubuntu disc and run the rescue feature. This gives you a root prompt. I chose the new installation’s root as the root of my rescue session and manually mounted /boot. I ran grub-install /dev/sda (the current location of the boot loader) and rebooted.

Now I’ve got a running Ubuntu system and can boot the old Fedora 9 installation, too. The first log in takes a half minute to bring up my desktop. This is the same problem I had on the Thinkpad, so I know it’ll be fixed when the updates are applied. Soon the Update Manager pops up and does its thing. Problem solved.

Things I needed to install that didn’t come out of the box:
gkrellm for system monitor
emacs for text editing
startupmanager to edit Grub 2 configuration
gnucash for budgeting and banking
flashplugin-installer for Shockwave Flash plugin for Firefox

Uncategorized

Comments (0)

Permalink

Fedora 8 DVD Permissions

Although it’s horribly out of date, I’m running Fedora 8 on my backup server, Mothball. Since the DVD burner on my desktop machine, Boon, has flaked out and eats discs rather than burning them, I’ve been using the burner on Mothball. (BTW, never buy a refurbished computer. It’s nothing but hassle.)

The UDev rules on Mothball cause the DVDRW drive (/dev/sr1) to get permissions only writeable by root. This is how to fix that:

Edit /etc/udev/rules.d/50-udev-default.rules
Change the line:
SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n"
to
SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", MODE="0664"

udevtest /dev/sr1 can be used for testing your rules.
udevcontrol reload_rules will supposedly reload them, but my permissions didn’t change until I rebooted.

Uncategorized

Comments (0)

Permalink