Igor here again; we're back from our meal. Where were we? Oh, yes - the first signs of life and all that. Since the entries from here on will be rather dry and technical, I'll give a short version at the beginning of each entry for those in a hurry, with details to follow on.
Synopsis:
We now have the following partitions/mounts added to our system:
/dev/hdd1, 4 Gigabytes, mounted on /mnt/lfs (the destination for our work)
/dev/hdd2, 1 Gigabyte, mounted as swap
/dev/hdd3, 14 Gigabytes, mounted on /home/lfs (for user lfs's files).(If you're interested in why and how this was done, keep reading.)
It was late last evening when we first fired up our small cybernetic creation, and the first of our preparations after the system booted to a root prompt was to select and implement a partitioning scheme for LFS. As the first drive was already loaded with a bootable Linux (PCLinuxOS 2009.2), we left it intact as a diagnostic and testing toolkit, and chose the second drive, /dev/hdd, (roughly 20 GB in size) as the eventual field for our labors.
There are two command-line tools provided for partitioning disks in Linux: fdisk and cfdisk. Both are entirely capable tools, however, as I was tasked with setting up the partitions (the Doctor having been called away to make a house call), I chose cfdisk as the more "friendly" option.
I won't bore the reader further here with the details of each keystroke, merely state that I was perhaps a trifle conservative in setting things up. Here's how the drive's partition table looked after I got through:
Disk /dev/hdd Partition Table:
/dev/hdd2, about 1 gigabyte, non-boot, type 82 (Swap) primary partition.
/dev/hdd3, about 14 gigabytes, non-boot, type 83 (Linux) primary partition.
These partition sizes more than adequately allocated space for our endeavors, however, once the partition table was written we were only halfway there. Now fell to me the task of creating filesystems on these which would serve our needs. I used the utilities mke2fs, mkswap, mkdir, and mount to create and mount the partitions as follows, starting with the first partition:
root # mke2fs -jv /dev/hdd1 (note -j switch used here)
Having created this first partition, the LFS documentation advised creating an environment variable, $LFS, using export as follows:
root# export LFS=/mnt/lfs
This is a convenience, and I obliged since it basically allows referring to the path /mnt/lfs by typing $LFS in to substitute for it. Continuing after this little side trip, I made the rest of the filesystems as follow:
root # mkswap /dev/hdd2
root # mke2fs -jv /dev/hdd3 (note -j switch here as well)
{Note that those more familiar with Windows or MS-DOS may be more familiar with the term "formatting" instead of "filesystem creation". It amounts to the same thing. Talk of "formatting" however, will mark one as a tyro in Linux circles, and knowing this may be helpful in avoiding that unpleasant label later on, but I digress.}
At this point, the filesystems are "all dressed up with no place to go". We remedy this by use of the mkdir command:
root# mkdir -pv $LFS
(see how much simpler that is than "mkdir -pv /mnt/lfs"? Also note the use of the -p "parents" switch.)
root# mkdir -v /home/lfs
(note we did not use -p here. man mkdir explains what -p does.)
It's worth noting that this last bit is not covered in the LFS manual. I did this as a way of ensuring that a persistent home for user "lfs" exists, since (when booted from the LiveCD) the /home directory exists as a virtual folder and vanishes promptly on reboot or shutdown.
One of the mistakes I made first time round was to attempt to make this directory simply /home, a folder which already existed. The way I have it now, the /home/lfs folder exists as a partition that is re-mountable on /home after each startup. That way, the primary user's configuration and other files are saved for re-use with each new session.
Now that we have the mount points established, it remains to mount the partitions:
root# mount -v -t ext3 /dev/hdd1 $LFS
root# mount -v -t ext3 /dev/hdd3 /home/lfs
Finally, we turn on the swap partition:
root# /sbin/swapon -v /dev/hdd2
With that, I take my leave of you for the time being. Perhaps the good Doctor will put in an appearance for the next phase.

No comments:
Post a Comment