Adding a new IDE harddrive

Jerry McAllister jerrymc at clunix.cl.msu.edu
Wed Apr 23 13:59:33 PDT 2003


>
> -bash-2.05b$ df -h
> Filesystem    Size    Used   Avail Capacity  Mounted on
> /dev/ad0s1a   591M    80M    463M    15%     /
> /dev/ad0s1e    11G   2.1G    7.7G    22%     /usr
> /dev/ad0s1f   984M   7.5M    898M     1%     /var
> /dev/ad1s1e   808M   406K    743M     0%     /tmp
> procfs        4.0K   4.0K      0B   100%     /proc
> /dev/da0s4     96M   65M      31M    68%     /zip
>
 
Hmmm.   It doesn't look like you are low on disk anywhere.
Your /usr filesystem is only 22% utilized.  And you have lots
more space available on it than on the ad1 (second) drive - unless
you aren't using it all in that /tmp partition (ad1s1e) - probably
you aren't as 808 MB is pretty small for a modern disk.  Did you
put the whole disk in one FreeBSD slice as you should with either fdisk(8)
or /stand/sysinstall?
 
> Actually!  What I was just thinking of doing is getting the new, larger  (2nd
> IDE) harddrive, and just allocating that to /USR/HOME, which is what I really
> needed it for in the first place,... space was running out on my current
> /usr/home directory.  The /TMP dir that you see above is actually on the
> current, 2nd harddrive.  I could just get rid of the /tmp entry (and 2nd
> harddrive) in my /etc/fstab directory, and just let "/" (1st Harddrive)
> handle the /tmp dir as it did before.  Then the /USR dir could be used just
> for FreeBSD ports and other binaries that are installed.  :-)   There....I
> solved the problem myself...  lol
 
Anyway, if /usr/home is where you have users' home directories, it
is a good idea to get them out in to their own space - separate from
system stuff.  (We tend to use just /home because it is less to type)
 
It is also a good idea to have /tmp outside of root.
You want to avoid the possibility of something filling the root
filesystem up if possible and /tmp is one of those things that can
get hit with runaway stuff if something gets out of control.   /var/log
and /var/spool are two other good candidates to keep separate from
root which you have done by making the separate big /var filesystem.
 
So, presuming ad1 is really bigger than what shows in the df above, more
like the size of ad0, the thing to do is probably create two file systems
on it with disklabel or /stand/sysinstall.   Keep one nice sized one -
maybe the same as is there now there to mount as /tmp and then use the
rest in another (ad1s1f) [or a or g or h] filesystem that you will
eventually mount as /usr/home or whatever you like to call it.
 
      fsck(8) the new filesystem
        fsck /dev/ad1s1f
Then, go to single user,
      shutdown -s now
      mount that new filesystem (ad1s1f) as something else temporarily
        lets call it scratch
        cd /
        mkdir scratch
        mount /dev/ad1s1f /scratch
      tar up everything is your /usr/home directory and put it in scratch
        cd /usr/home
        tar -cpf /scratch/home.tar *
        cd /scratch
        tar xpf home.tar
      Check things out a little to make sure it got there OK.
      nuke everything in the old /usr/home
        cd /usr/home
        rm -rf *             wow, be careful doing this - not in root
      Make sure everything got deleted.
      Add a mount in /etc/fstab so /dev/ad1s1f will mount as /usr/home
        just copy another one in the file and fix it up properly.
      unmount the new filesystem from scratch
        umount /scratch
      Do a mount -a
      You should be back in business.
      either reboot or just go on to multi-user with a CTRL-D
 
You can skip making the tar file by piping a tar cpf - * to a tar xp -
but I always feel more secure having that interim tar file sitting there
when I nuke the old stuff.

You could move the stuff using a cp -R -p * ...  but you might mess up
any hard links that were there.   So, tar is better.

You can avoid deleting the files by renaming the /usr/home directory
and making a new one for the mount.
        cd /usr
        mv home old.home
        mkdir home

////jerry

>
>
> On Wednesday 23 April 2003 09:14, you wrote:
> > > Is there I could DISKIMAGE or DISKCOPY my filesystem from an old drive to
> > > a new (bigger) harddrive, then expand the filesystem on the newdrive to
> > > accomodate for  more space, thus, allowing me to make my directories,
> > > etc...bigger  
 


More information about the freebsd-questions mailing list