Sunday, November 11, 2007

mount, umount and ln -s

sudo mkdir /media/eagle
sudo mount /dev/sdb2 /media/eagle

For automatically mount, edit /etc/fstab
sudo vim /etc/fstab
Add the follow line the the end of fstab file:
/dev/sda2 /media/eagle ext3 defaults 1 2

Example:

/etc/fstab

automount

Being able to mount filesystems manually is all well and good. But I want to mount a whole bunch of filesystems at boot up time. To do that, I set up /etc/fstab with a descriptions of all my filesystems that are to be automounted.

/etc/fstab has a simple format. One filesystem per line, 6 columns per line, separated by white space. The first four columns are the same information you type in when using mount manually.

  • first column - the device to mount
  • second column - the mount point
  • third column - the filesystem type
  • fourth column - options (-o)

The last two columns contain two numbers.

  • fifth column - which filesystems need to be dumped, that is - backed up with the dump utility. As Slackware no longer comes with the dump backup utility, you can safely ignore this column. The Slackware installation sets this column to 1 for non-removable real filesystems. I've just left it as is.
    • 0 = does not need to be backed up with dump
    • 1 = needs to be backed up with dump
  • sixth column - used by fsck to determine the order that file system checks are done at reboot time
    • root partition should have 1 here
    • other filesystems should have 2 here
    • filesystems that do not need fsck, or filesystems that are not always mounted, or removable media should have 0 here

Some special file system types can be included in /etc/fstab. The three most common ones are the swap partitions, the /proc pseudo device, and the /dev/pts pseudo terminal directory. These will be set up for you ate installation time, and you shouldn't need to fiddle with them.

Here is my fstab set up for the systems that I want loaded at boot time.

/dev/hdb2      swap          swap     defaults         0   0
/dev/hdb1 / ext3 defaults 1 1
/dev/hdb3 /usr ext3 defaults 1 2
/dev/hdb5 /usr/local ext3 defaults 1 2
/dev/hdb6 /opt ext3 defaults 1 2
/dev/hdb7 /home ext3 defaults 1 2
/dev/hdb8 /data ext3 defaults 1 2
/dev/hda1 /mnt/dosc vfat defaults,uid=1000,gid=100,umask=022 1 0
/dev/hda5 /mnt/dosd vfat defaults,uid=1000,gid=100,umask=022 1 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
mp3:/mnt/mp40 /mnt/music1 nfs defaults 0 0
mp3:/mnt/mp80 /mnt/music2 nfs defaults 0 0

Install Fedora

1. Preparation
A) Back up data. Don't forget you ".mozilla" kind of files/folders. A list:
.vimrc .bashrc .thunderbird .mozilla .gnuplot-history . . .
and of course, your personal important data!!
If your data are in different partition from system ( everybody should install system this way. Keeping system files and personal data in one drive/partition is Windoz way.), make sure you just link to that partition. DO NOT make that partition /home or what so ever. Symbolic link is the easiest way to handle this, because when you install new system (every half year for Fedora), just simply format / partition (probably swap partition too). Leave data partition alone (Don't do anything about it). After the fresh installation. Symbolic link is your friend. This way, you don't even need to back your data . Really? Oh, well, it is always a good idea to periodically back up data, isn't it? I am sure you already have your data in a safe place.

Oh, you don't know howto setup symbolic link? google it.
ln -s /media/WD-drive/simulation /home/joying/simulation

How to remove the link?
unlink simulation

B) Download images from fedora project website. The mirrors in US is not necessarily faster (or broader band).

2. Installation
A) Install from DVD(all). This is the easiest way to do.
B) Install from hard drive for old laptops which has no DVD-rom. Make a rescue disc, then boot the computer using rescue CD. Choose install from hard drive. Now, make sure you have ISO file in the hard drive.

3. Tweak it (In the way you want it to be)

Symbolic link

ln -s [target] [from]

Example:
You don't have simulation folder in your home directory yet now. But you DO have a simulaion directory in another hard drive/ partition. You want to set up a link in your home folder ( /home/joying/simulaion) to a different partition/hard drive ( /media/_home/simulation).
SO the command would be:
ln -s /media/_home/simulation /home/joying/simulation

If you want to remove the link,
cd /home/joying
unlink simulation


########################################

When using the rm or unlink command to remove a symbolic link to a directory, make sure you don’t end the target with a ‘/’ character because it will create an error. Example:

$ mkdir dirfoo
$ ln -s dirfoo lnfoo
$ rm lnfoo/
rm cannot remove directory ‘lnfoo/’ : Is a directory
$ unlink lnfoo/
unlink: cannot unlink ‘lnfoo/’: Not a directory
$ unlink lnfoo
$

Notice how one complains it “Is a directory”, but the other complains it is “Not a directory”, which I found confusing. This is a problem if you have a tendency to use tab completion a lot, because it will stick a ‘/’ at the end.