marketing information is wealth: November 2009

Monday, November 9, 2009

Formatting a Partition

In BasicLinux, use the following command to place a Linux file system a partition /dev/hda3 and determine if the partition has any bad sectors.
mke2fs -t /dev/hda3
In Debian Linux 2.2 and 3.1 the equivalent command would be
mkfs -t ext2 /dev/hda3
The BasicLinux command mke2fs automatically makes a Linux file system while it is necessary to tell mkfs in Debian that we want a Linux (i.e., ext2) file system.
In BasicLinux you can make and mount a second 4 meg ramdisk (again, solely in the computer’s memory) using the commands
mke2fs /dev/ram2 4096
mount /dev/ram2 /mnt
This will give you practice without damaging the file systems on the computer’s
actual hard disk(s).

Command (m for help)

You should not run this program on anyone else’s computer and you should use use it only to determine the layout of the drives on your own computer unless you have backed up all your files! To exit fdisk without doing damage, enter the command q. The discussion below assumes that you want to modify the partitions or create new ones on a computer on which you plan to install a ‘real’ version of Linux.
Before proceeding further, you should copy down on a piece of paper the above information not only for the disk you are planning to restructure but for all disks on the computer. You can find the total size of the disk in bytes by multiplying 16065 by 512, in the above case, to obtain the
number of bytes per unit (or cylinder), and then multiply that number by the number of cylinders. To find the size of any partition, multiply the number of cylinders in the partition by the number of bytes per cylinder calculated above.
To delete a partition press d and then, when prompted, the number of the partition, where /dev/hda1 is the first partition and /dev/hda2 is the second partition, and so forth. Deletion of any partition marked ‘extended’ in the right-most column of the partition table will automatically delete any partitions associated with the blocks that are in that extended partition. If you are going to set up Linux on the disk you should delete all partitions unless you are doing the initial install from a DOS partition. In that event you should leave as is an appropriate DOS partition that you or someone else should have previously set up using DOS FDISK. Indeed, you can even have on that partition MS-Windows 95/98 which you can install Linux from and then keep and use on occasion for browsing the Web, etc.
To add a partition press n. You will be asked whether you want to add a primary or an extended partition. Press p to create a primary partition. You will then be asked the number to give the partition. Start with 1, assuming that your previously created DOS partition is not partition 1. You will be asked to specify the first cylinder of the new partition—you can usually use the default here and press ENTER. You will then be asked to specify the last cylinder or the size in either cylinders, kilobytes, or megabytes. To pick the last cylinder, just enter the number of the cylinder. Alternatively, to set the size in cylinders and let the program find the last cylinder, enter +nnn where nnn is the number of cylinders. To set the size in megabytes, enter +nnnM
where nnn is the number of megabytes.

Using Linux fdisk

To find out what partitions exist on a computer and to modify those partitions you need to use the Linux fdisk program. To start fdisk enter the command (I again ignore the command prompt)
fdisk /dev/hda
where hda refers to the first hard disk drive on the computer. To work on the second disk drive, change this to hdb. You will receive the reply
Command (m for help):
and after typing m your screen will appear as follows:
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help):
To find out what the existing partitions are on the hard disk, press p. Your screen will appear as follows.
Command (m for help): p
Disk /dev/hda: 255 heads, 63 sectors, 789 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 382 3068383+ b Win95 FAT32
/dev/hda2 383 550 1349460 83 Linux
/dev/hda3 551 567 136552+ 82 Linux swap
/dev/hda4 568 789 1783215 83 Linux

Telnet: Reading Your Mail

When you are connected to the Web and have the appropriate privileges from your ISP you can use the telnet command log on to your ISP and work as an ordinary user on that machine. If the ISP has the program pine installed you can use it to check your mail. Suppose, for example, that you have a CHASS account. Log into CHASS using the command
/# telnet chass.utoronto.ca
and reply to the prompts with your username and password. To read your mail, enter at the % command prompt the word pine:
/homes/username % pine
It will be obvious how to proceed from the options on the screen and the help menu along the bottom of it. If you are a University of Toronto student or faculty member and have
a UTORDIAL account you can read mail you receive at that address by executing the command
/# telnet log.agent.utoronto.ca and responding to the login prompt with the relevant digits of your library card and typing your password when asked. Then select the option ‘1. UTORmail via Pine’ by pressing the ‘1’ key but do not press ENTER. You will be asked to enter your password a second time. After that you use pine in the same way as in the CHASS account.

Getting Connected to the Internet

If you are thinking about setting up a Linux distribution for yourself, the most important hurdle will be setting up a dial-in connection to access the Internet. The connection will use the Point-to-Point Protocol, otherwise known as PPP. If your computer is hardwired directly to a network, you should have been using Tom’s distribution thus far if it automatically detects your ethernet card and establishes a connection. In Debian Linux you will be prompted to establish this connection in the process of setting up the system. If you have to work through a modem, setting up an Internet connection is less transparent and can be quite difficult if you are dealing
with a university network whose service may be free and not-for-profit, with the result that university personnel have no incentive to support anything but MS-Windows operating systems.
It turns out that an Internet connection can be established rather easily in BasicLinux. After the system loads, execute the command
/<#>pppsetup
and you will be presented with a screen giving a number of options. Choose ‘2. Edit your PPP settings’. You will be prompted to modify a number of files. The first one will appear on the screen as follows:
#!/bin/sh
#
# substitute your ISP's telephone number for 087304484
#
# if your ISP uses PAP/CHAP then remove the last two lines;
# otherwise, substitute your username/password for ichi/xxx
exec chat \
TIMEOUT 3 \
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
'' \rAT \
TIMEOUT 30 \
OK ATS11=55 \
OK ATDT087304484 \
CONNECT '' \
ogin ichi \
word xxx
If your Internet Service Provide uses either the PAP or the CHAP protocol your task is dead-easy. Simply do as instructed and press the Ctrl and x keys simultaneously to save your changes and exit the screen. If your ISP requires a text dialogue, as do the University of Toronto Systems, things can get quite complicated. To proceed, you must be using the version of BasicLinux obtained from my website.