sleddog
03-28-2001, 11:00 AM
[Too late I realized that "WILL - Part I" should not have been in the After Hours Forum. That forum advises "no techie stuff here!"]
Why I Love Linux - Part II
Can you imagine a world without drive letters? Have you even popped a 2nd harddrive in a machine and had it mess up everything? D becomes F, E becomes H, and god knows where the CDROM ends up. Just who's in charge here, anyway?!
Welcome to the Unix filesystem, where drive letters are a blessedly unknown concept.
Linux uses a native Unix-style filesystem called ext2. It's a flexible and extensible system that takes a totally different approach than does the DOS-based system we're familiar with.
The filesystem is a tree, beginning at the root "/". From /, directories are created -- for example /home and /tmp. These of course can have subdirectories: e.g., /home/sleddog
Much like DOS, you say, except it uses a forward-slash separator (/) instead of the backslash (\).
The magic comes with how this filesystem works with harddrives and partitions.
Suppose we have a harddrive fdisked with 3 partitions. In DOS we'd get this:
-- C drive, the primary partition
-- D drive, a logical drive in the extended partition
-- E drive, a logical drive in the extended partition
Linux would see it this way:
-- hda1, the primary partition
-- hda2, the extended partition
-- hda5, a logical drive in the extended partition
-- hda6, a logical drive in the extended partition
So the three partitions where data is stored are hda1, hda5 and hda6. (What happened to hda3 and hda4? Those designations are reserved for other *primary* partitions -- a harddrive can have up to 4 primary partitions.)
But you don't "see" hda1 or hda5 in the Linux filesystem. You see the directory tree you created (as above). The harddrive partitions are "plugged into" the directory tree, wherever you want them to be.
On a Linux system all user-files are usually stored in the /home directory. Suppose we want these files to reside on the second harddrive partition (hda5). In Linux we issue the command:
mount /dev/hda5 /home
And the hda5 partition is now accessed through the directory /home. Of course, mount commands like this are usually executed automatically when Linux first boots.
This approach provides you -- the user -- with complete control of your filesystem and harddrives. *You* decide *exactly* how you want you drives and partitions to appear in the filesystem.
Supoosed that partition hda5 started to get pretty full and you need to upgrade to a larger harddrive. Yet get a nice new 30gb and partition it. Now installing it in a DOS/Windows system without disrupting all the drive letters is pretty darn difficult.
Here's how you could do it in Linux. This assumes for the sake of illustration that the 30gb is installed as the second harddrive, and you're going to use the 1st partition on that drive):
mount /dev/hdb1 /mnt/tmp
cd /home
cp -a * /mnt/tmp
umount /mnt/tmp
umount /home
mount /dev/hdb1 /home
These commands do this:
1. plugs the new harddrive into the filesystem at a temporary place.
2. changes the current working directory to /home
3. Copies ("-a" means archive, which copies recursively) everything currenlyt in /home to the tmp location where the new harddrive is mounted.
4. unmounts, or releases, the new drive partition from the temporary place.
5. unmounts the old partition from /home
6. mounts the new drive partition at /home
The filesystem is *exactly* the same as before, except now you've got tons of diskspace at /home! (of course you'd also edit the boot-up mount command so it automatically mounts the new drive partition at /home instead of the old partition).
Where's my CDROM drive? at /cdrom of course, and the floppy drive is /floppy!
So long alphabet soup!
------------------
sleddog
[sleddog.f2s.com] (http://www.sleddog.f2s.com)
Why I Love Linux - Part II
Can you imagine a world without drive letters? Have you even popped a 2nd harddrive in a machine and had it mess up everything? D becomes F, E becomes H, and god knows where the CDROM ends up. Just who's in charge here, anyway?!
Welcome to the Unix filesystem, where drive letters are a blessedly unknown concept.
Linux uses a native Unix-style filesystem called ext2. It's a flexible and extensible system that takes a totally different approach than does the DOS-based system we're familiar with.
The filesystem is a tree, beginning at the root "/". From /, directories are created -- for example /home and /tmp. These of course can have subdirectories: e.g., /home/sleddog
Much like DOS, you say, except it uses a forward-slash separator (/) instead of the backslash (\).
The magic comes with how this filesystem works with harddrives and partitions.
Suppose we have a harddrive fdisked with 3 partitions. In DOS we'd get this:
-- C drive, the primary partition
-- D drive, a logical drive in the extended partition
-- E drive, a logical drive in the extended partition
Linux would see it this way:
-- hda1, the primary partition
-- hda2, the extended partition
-- hda5, a logical drive in the extended partition
-- hda6, a logical drive in the extended partition
So the three partitions where data is stored are hda1, hda5 and hda6. (What happened to hda3 and hda4? Those designations are reserved for other *primary* partitions -- a harddrive can have up to 4 primary partitions.)
But you don't "see" hda1 or hda5 in the Linux filesystem. You see the directory tree you created (as above). The harddrive partitions are "plugged into" the directory tree, wherever you want them to be.
On a Linux system all user-files are usually stored in the /home directory. Suppose we want these files to reside on the second harddrive partition (hda5). In Linux we issue the command:
mount /dev/hda5 /home
And the hda5 partition is now accessed through the directory /home. Of course, mount commands like this are usually executed automatically when Linux first boots.
This approach provides you -- the user -- with complete control of your filesystem and harddrives. *You* decide *exactly* how you want you drives and partitions to appear in the filesystem.
Supoosed that partition hda5 started to get pretty full and you need to upgrade to a larger harddrive. Yet get a nice new 30gb and partition it. Now installing it in a DOS/Windows system without disrupting all the drive letters is pretty darn difficult.
Here's how you could do it in Linux. This assumes for the sake of illustration that the 30gb is installed as the second harddrive, and you're going to use the 1st partition on that drive):
mount /dev/hdb1 /mnt/tmp
cd /home
cp -a * /mnt/tmp
umount /mnt/tmp
umount /home
mount /dev/hdb1 /home
These commands do this:
1. plugs the new harddrive into the filesystem at a temporary place.
2. changes the current working directory to /home
3. Copies ("-a" means archive, which copies recursively) everything currenlyt in /home to the tmp location where the new harddrive is mounted.
4. unmounts, or releases, the new drive partition from the temporary place.
5. unmounts the old partition from /home
6. mounts the new drive partition at /home
The filesystem is *exactly* the same as before, except now you've got tons of diskspace at /home! (of course you'd also edit the boot-up mount command so it automatically mounts the new drive partition at /home instead of the old partition).
Where's my CDROM drive? at /cdrom of course, and the floppy drive is /floppy!
So long alphabet soup!
------------------
sleddog
[sleddog.f2s.com] (http://www.sleddog.f2s.com)