HOWTO? I want to add an additional HD

Stefan Bruda yellowdog-general@lists.terrasoftsolutions.com
Mon Aug 19 16:05:01 2002


At 14:09 -0700 on 2002-8-18 bronto wrote:
 >
 > While doing this it occurred to me that I will have other data that
 > needs to go on the 60 gig disk too; specifically the user email
 > accounts and sql databases.  So it seems to me that I should have
 > the whole /var directory on the new disk as well.

Yep.  Now that you mention it, it looks to me like a good idea too.

 > But I'm having trouble getting my head wrapped around the
 > implications of this file system where the hardware is abstracted
 > from the directory structure.

In essence, any directory in the Unix file system can become a mount
point, i.e., refer to a phisically different partition.  For example,
you can decide that /var/spool/mail should actually reside on, say
partition 10 of the second IDE drive, you could include in /etc/fstab
an entry like this:

      /dev/hdb10        /var/spool/mail ext2    defaults        1  2

and you are all set upon reboot (don't forget however to move the old
content of /var/spool/mail to the new partition before you reboot,
like you did for the /home directory).  By using variants of the above
/etc/fstab entry you can basically mount a disk partition to replace
any directory in the Unix file system tree.

Now if you really want to use the _same_ partition for both /home and,
say, /var, you can do this by creating a directory on /home, e.g.,

      mkdir /home/.var

(actually, you can create any directory you want, I chose to create a
hidden directory just in case you forget later about your arrangement
and decide to create the user `var' with /home/var as home directory
;-) ).  Anyway, you can then move the content of /var to /home/.var
(using mv or tar pipes or cpio, as suggested in previous postings),
remove the whole /var:

      rm -rf /var

and re-create /var as a symbolic link (I believe that hard links may
generate problems since / is mounted before /home):

      ln -s /home/.var /var

Though I did not explore this myself, I should also mention that in
recent Linux versions it is even possible to remount part of the file
hierarchy to some other place with the same effect as the above
procedure (see man mount for details).

This being said, and although I can think of reasons for doing
something like this, I can also think of reasons not to do it.  In
fact, I have never used an arrangement like the one I just described.
If I were you, I would simply create a separate partition for /var on
your large disk (on which I would thus have two partitions instead of
one).

 > Is it as simple as repeating instructions from "mkdir" to "mount"
 > as below, only for the var directory?  It doesn't seem that I would
 > have to create a whole new partition for /var, but I get lost in
 > all this.

I just described one way to avoid creating a new partition, but again
I would personally create such (but don't forget to back up your /home
first, as repartitioning destroys the information on the disk being
repartitioned).

Cheers,
Stefan

-- 
If it was so, it might be; and if it were so, it would be; but as
it isn't, it ain't. That's logic.
    --Lewis Carroll, Through the Looking-Glass