Hard Disk woes

Posted in Bangalore, Free Software at 6:17 pm by Pirate Praveen

Yesterday (on Software Freedom Day) we asked interested BMS students to write down their contact details, interested areas, whether interested to work on a project, want to join bmslug. We got an awesome response from 90 folks, most of them interested in doing a project with most wanting to focus on DBMS and OS [May be beacuse I added dbms, OS etc 🙂 ].

So I thought I will create a spreadsheet with this information. I booted up to my brand new ‘old’ linux-based GNU system to see I have not installed Open Office Calc (I have Writer and Drawing). OK let me give you the details of my system so you will know the reason behind this.

CPU – Pentium 2 (Klamath) 266 MHz
RAM – 256MB (static)
Hard Disk – Maxtor 82160D2, 2014MB

(There was a time when I didn’t get a hard disk and I used operate on Live CDs)

On this I have 3 operating systems running.

1. Debian GNU/Linux
2. GNU (also known as GNU/Hurd)
3. GNU Emacs (with GNU Hurd as a driver)

I initially gave 1.1 GB for GNU/Linux root partition, 256 MB swap and 700 MB for /home. Then I installed the GNU system (see my earlier post to see how you can setup it). I copied all the data from /home partition to root partition, removed that entry from /etc/fstab and started uncompressing the GNU snapshot provided by GNU System release manager AMS (Alfred M Schmidt). But the uncompressed image didn’t fit in 700 MB so I resized the swap partition to 140 MB (anyway it is always showing 0 MB used) and increased the third partition size to 800 MB. I used GTK+ gui for the GNU partition editor (gparted), and it rocks! The proprietory alternative is partition magic and the experience I had with that tool was never positive (see my earlier post about why I had to use it). But I had to repeat the process again even though it fitted since I forgot to give an option while creating the partition (I have mentioned it in my earlier post so you don’t have to face the same issue again).

I had installed GNOME initially but I removed it because

1. It was heavy
2. I could not fit Open Office and GNOME together

I thought I would not need the spreadsheet and didn’t install it. I installed WindowMaker as my primary Desktop Environment. It simply rocks! Every one from NIT Calicut would be familiar with it as it was the default desktop environment in our thin-client Main Computer Center (and no other environment was available. We tried GNOME and KDE but it used to be too heavy for more than 40 clients for a server. But I have installed xfce as an option when I was the system administrator in 4th year).

Today when I checked the Hard disk usage statistics to see if I can install oocalc, this was the status:

* root partition 4.7 MB free
* swap 140 MB

As swap is not used anyway I thought I would reduce swap and give it to the root partition. I fired up gparted again and resized swap to 70MB, the extended partion moved that much to have the the freedup space available for the GNU/Linux partition. Let me give you the layout my hard disk to make it clearer

* Total space 2 GB
* primary partition hdd1 size 1.1 GB
* extended partition hdd2 from 1.1 MB till 2 GB
* first logical partition hdd5 from 1.1 MB filling next 140 MB
* second logical partition hdd6 till 2 GB

Now I have to resize the root partition to take up the freed up space, but there is one problem, I cannot do it when booted to GNU/Linux since it is the root partition and is mounted and I cannot unmount it. OK, it clicked to me that I can use my second OS GNU for that since it has got parted. I rebooted the system , but there was a problem and GNU failed to boot up.

I figured it was because the partition order has changed, the moment I deleted the swap partition (I had to delete it because the resize of the logical partition left out some free space in the beginning and Zahir suggested to remove the swap, resize the extended partition and create the swap partition again) hdd6 has become hdd5 (but only after reboot the new partition table could be loaded and creation of swap partition failed here).

I went into grub commandline and checked the partitions and found out the new root for GNU is (hd0,4) instead of (hd0,5) (linux does its numbering based on where the hard disk is connected whereas grub does it based on the no. of hard disks hence linux detected it as hdd it is hd0 for grub since there is only one hard disk and it is the first one – See next paragraph for more details). Also I had to change the root for gnumach from device:hd3s6 to hd3s5. The different naming schemes used by different programs is one hurdle to cross, but once you could visualise it you can easily figure out.

One hard disk can have a maximum of 4 primary partitions and the logical partitions are always numbered from 5. So (hd0,4) signifies first logical partition for grub since grub starts counting from 0. Hard disk 0 and after leaving 4 postions ( 0-3 ) it starts counting logical partitions from 4. Since it is connected as secondary slave it is hdd for linux (hda is primary master, hdb is primary slave – my CD RW drive is connected here, hdc is secondary master), and since it starts counting partitions from 1 it is hdd5 (1-4 is reserved for primary partitions. Here hdd2 is the extended partition which holds the logical partitions). Now for gnumach it is hd3s5 as harddisks are numbered from 0 and partitions are numbered from 1 (hda for linux is hd0, hdb is hd1, hdc is hd2 and hdd is hd3. s1 stands for slice 1 and it is similar to BSD naming scheme, but I am not too familiar with that naming system).

So I now booted into GNU and fired up GNU Partition Editor (parted) and tried to move the partion but it said

“Not implemented: The ext2 system has a strange layout and resizing it is not implemented (yet)”

So I tried to resize instead of move but again the same result and it said it has got a bug. So I was stuck, I cannot increase the partition size 🙁

I thought about the problem, I cannot resize it because I am already using it (it is similar to cutting the branch of try while you sit on that), so I have to get an environment with parted but not using the root partition. GNU was one such option and with this bug I couldn’t go forward. Then it occured to me I could boot from a CD and partition it and come back. So I inserted the first installtion CD of Debian Etch beta 3 (the one which I am running currently) and entered rescue mode and got a shell in the CD environment.

I fired up parted again

# parted /dev/hdd

The initial partition was from 32.3 B to 1102 MB and I resized it to have new size from 32.3 MB to 1176 MB (where the extended partition started). Then booted back to GNU/Linux on the harddisk and everything worked fine and now I got 68MB of free space. I installed openoffice.org-calc and still I have 50 MB more of merry 🙂


The final Hard Disk Layout

I rebooted into GNU since I didn’t have Emacs in the first two CDs of Etch (it was also not there in Ubuntu Dapper, previously I installed gcc 4.0 from Ubuntu to match my kernel magic for linux kernel programming as the kernel was compiled using gcc 4.0 and the gcc version in testing now is gcc 4.1 which is default. By the time Etch will be released in December we will have 2.6.17 compiled with gcc 4.1 thus solving this issue (now the kernel version in testing is 2.6.16) I had installed gcc 4.0 for my collegue in office from debian mirrors itself as we had an internet connection there (it is a small gcc migration issue and it will be solved when all packages are migrated to gcc 4.1).

So here I am completing the article in GNU Emacs on a complete GNU system. Now I will have to go back to GNU/Linux and complete the spreadsheet which triggered all this drama.


  1. ravi said,

    September 17, 2006 at 6:50 pm

    Why not install gnumeric?
    or simply use oleo?

  2. Praveen A said,

    September 24, 2006 at 3:11 pm


    I already had OpenOffice Writer and Impress so installing Calc was better choice considering the available disk space 🙁 as gnumeric needed more space than Calc added to the existing OpenOffice.

    Thanks for Oleo info, I will check that out.

Leave a Comment