Folders and Files

Now, let's populate our new filesystem with a few folders and files.
Make sure your linux2 partition is still mounted (however, you are still
in linux1). If you haven't rebooted, it will still be. Goto that directory
by typing cd /mnt/linux2
Type the following (be careful of spelling, and again, make sure you
are mounted):
mkdir bin boot etc home
lib mnt proc root sbin tmp usr var
Next, go into your newly made /usr directory by typing cd /mnt/linux2/usr
Make the following directories inside this directory by typing:
mkdir bin include man sbin
share src
Next, go into your newly made /usr/man directory by typing:
cd /mnt/linux2/usr/man
Make the following directories inside this directory by typing: mkdir
man1 man2 man3 man4 man5 man6 man7 man8
Next, go into your newly made /usr/share directory by typing
cd /mnt/linux2/usr/share
Make the following directories inside this directory by typing: mkdir
aclocal autoconf automake
Next, type the following to create another directory:
mkdir /mnt/linux2/var/run
Now, the only directory we are missing is the /dev directory. The easiest
way to make this as well as populate it is to copy it from your existing
distribution. We could make it from scratch with the mknod command, but
it will give you the same output as copying it plus it takes a while.
So, at the prompt, type cp -dpR /dev /mnt/linux2. The -dpR will keep order
in this directory, preserve permissions, and not attempt to read the files
while copying (this has a nasty habit of locking up the system - and yes,
that is a space after /dev). Feel free to prune out this directory by
deleting un-needed devices if you know what these devices are.
Now, let's copy the kernel from your existing linux1 distribution to
the new linux2 distribution. It's normally located in the /boot directory
and that is where you should put it in the new distribution to maintain
linux file hierarchy standards. Type cp /boot/vmlinuz /mnt/linux2/boot.
You substitute whatever the name of your kernel is for vmlinuz - Again,
don't worry, we will be making our own kernel in a future chapter.
Next, we need to copy the /etc/passwd and the /etc/group file from your
existing system to the new system. These are your password and group belonging
files. But, BEFORE we can do that, we need to determine weather or not
your system is using shadow passwords or not. If it is, we need to temporarily
disable it for the copy. The easiest way to check this is to open up your
/etc/passwd file with vi. Here's what mine looks like (and yes, I changed
the password for this purpose!):

Notice the very first line says root: and then a bunch of
crazy characters? This means you are not using shadow passwords. If yours
looks like that, go ahead and copy these two files over to /mnt/linux2/etc
If yours only has one x or one * between colons, that means
you are using shadow passwords. We need to disable these temporarily.
Type the following two commands at the prompt to turn them off:
pwunconv
grpunconv
Now go ahead and copy them over to /mnt/linux2/etc
Now, let's re-enable your shadow passwords by typing the
following:
pwconv
grpconv
Now that these files are copied over, edit them both and
get rid of everything except for the first line that contains the stuff
for root. Go ahead and save.
|