March 5, 2002

Mounting more space under Phat Linux (and a warning)

Author: JT Smith

- By Jesse Smith -

People, don't try this at home. This is not a how-to; it's more of a "how-not-to" cautionary tale. However, there is a lot of good information
in this story. Among other things, you'll learn how to get more drive space
under Phat Linux.

Recently, I did the stupidest thing I have ever done
to a Linux system. I deleted the C library. This is the library
(binary code) that nearly all Linux programs (it appears) use. I was
trying to upgrade the C library and without knowing exactly what
I was doing, and deleted the file /lib/

This file is nothing much, just a small, symbolic link to
the C library. However, the Phat Linux system assumes that, link
or not, there must be a file called /lib/ If not, then
almost nothing works. Commands to restore the link (ln -s) no
longer work. Neither does the move (mv) command. Nor log in.
All that worked, it seemed, was exit and cd. I couldn't even shut down.

This discovery was quickly followed by a number of words
I am glad my mother didn't hear. I have left out about five minutes
of my colourful monologue here.

So, after killing the power to my PC, I thought, "Well, maybe
the system will search for the library during boot up." I tried and, no, it doesn't search. It's either there or it is not. I then tried to boot Phat in single user mode. No good, still need the library to boot. So here I need the library to boot and I need to
boot to install the library. You may know that Phat Linux
does not come with a boot disk. As far as I know Tom's Root Boot
doesn't support loop-back file systems. Now what to do?

I went online (using Windows) and tried mIRC. They laughed at me for two reasons. One: I had deleted the file. Big
no-no. Two: I was running Phat Linux which, I was told, isn't real Linux. But the reason, that Phat Linux uses UMSDOS, was false -- Phat Linux does
not even support UMSDOS. It uses a loop-back device.
But moving on, no one could help me. "No boot disk, no work. Re-install."

I thought there might be another way. Because I develop Phat
Linux as a side project, I have an extra copy of the file system. I
booted up in DOS and renamed my damaged system (linux.img to trash.img).
I then renamed ph4linux.img to linux.img. With the good file system,
I then proceeded to boot. I searched through the Linux start up
files (found in /initrd/). There it seemed, I found the clue I needed.
I ran the losetup program to set /dev/loop6 to point at the file

Note: losetup prepares a device to be mounted.
I then created a directory (mkdir /initrd/mnt/img/) and typed
mount /dev/loop6 /initrd/mnt/img.
I now had my old (and unusable) file system mounted. Yes! I was
then able to move through the file system. I removed the bad libc
file and re-created the link (ln -s
You are supposed to make sure you are in /initrd/mnt/img/lib/
when you do something like that. Not being in /lib would destroy the
good file system. How I know that is another longggg story and
involves more colourful phrases.

Anyway, with the damage repaired, I unmounted the newly-fixed
file system and typed "umount /dev/loop6" to unmount the system. I could
then reboot my computer and put all the DOS files back in
their proper place. I then informed the people on mIRC that I had
performed a minor miracle and had learned my lesson. I didn't point out
that you usually can't do things like this with other Linux distros.

The point of my writing this, besides warning you not to
touch things in the /lib directory, is this:
There is a way to mount many Linux file systems
under Phat Linux. Instead of trying to grow your linux.img file under
DOS whenever you need more space (or deleting stuff) you can
simply make a new DOS file and mount it. The only limitations are
hard drive space and the new data must be put in the new file. For example,
if linux.img is full and I want to create a big file called abc.txt
I could create linuxnew.img and mount it. However, because linux.img
is full, all new data (abc.txt and any new files) would have to be
created in linuxnew.img. So, this lead me to the idea that you could create
several of these image files and move your file system into them.
For example, /usr/ could be stored in one loop-back file. /home/
could be held in another. Just don't put /initrd/ or /lib/ on another

It seems that after being so stupid, I end up feeling smart. But it is really an old idea. Using several partitions or disks to spread
out the file system is as old as UNIX. This would be an interesting
way of storing your files, though, under a same-partition Linux

To do so, you would need the ext2resize program from
either freshmeat or Then by making some interesting start up scripts, you could mount many
parts of your file system. I don't plan to do this ... yet. It's just
interesting to think about.

On a final note, if you don't know what I'm talking about, then
don't try this at home, folks. I know I shouldn't have.


  • Linux
Click Here!