Re: Put /usr on a different drive

2007-01-15 Thread Jerry McAllister
On Sun, Jan 14, 2007 at 10:46:48AM +0100, Daniel A. wrote:

 On 1/14/07, Jerry McAllister [EMAIL PROTECTED] wrote:
 On Sun, Jan 14, 2007 at 12:08:13AM +0100, Daniel A. wrote:
 
  Hi,
  I'm wondering if someone could point me in the right direction of
  moving the entire /usr partition to a second hard disk, given that I
  am on an existing (newly installed) install of FreeBSD.
 
  Also, is it possible to specify something like this during the
  installation itself?
 
 It is quite possible, but not quite as convenient as it could be if
 you are not familiar with the installer.
 
  ... much excised ...
 
   /dev/ad1s1a /usrufs rw  2   2
 
 Then reboot and things should be just hunkie-dori.
 
 
 jerry
 
 
  Sincerely,
  Daniel A.
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to 
 [EMAIL PROTECTED]
 
 That sounds absolutely fantastic!
 I did think over just copying the contents and then mounting the drive
 as /usr, but I was unsure if doing it so simple would break something.
 Apparently it wont, if I just do it in single-user mode?

Well, as long as you do it right.

 Anyway, now that I've got that settled, would anyone recommend me what
 to do with the now empty space in ad0?

What do you want to do with it?

First of all, I can't believe you can't get by with 55GB in /usr.
You must have stuff in there I would never put there, so take a 
look at what is using up all that space first before you start
moving it around.

Then, I would just mount that space previously used for /usr as
something else like /work or /scratch, empty it out and use it
for stashing stuff there like all pictures you take in a lifetime
or something like that.

 My current layout is like this:
 ad0 - 60GB
 1gb swap
 520M /
 520M /tmp
 55G /usr
 1.5G /var
 
 ad1 - 120GB
 (Currently only one partition, occupying full drive)
 
 Once I move my /usr to ad1, I'll have 55 gigabytes of space available
 on ad0, and nowhere to put it. I've thought of assigning that space to
 /var, but 55G would be overkill for a little home server like mine,
 don't you think?

You don't have to put it anywhere.   It is already there.
Just make up a mount point - which is just a directory and
is done with mkdir  as in   'mkdir /work'  or  'mkdir /scratch'
or  'mkdir /pics'  or  'mkdir /web'  or whatever you want.
Then mount the partition that had previously mounted as /usr
maybe it was  /dev/ad0s1e  on that new mount point.

It sort of looks like you must have put home directories for user 
accounts in /usr and I would suggest putting them in a filesystem 
just for them.  So, maybe you want to mount it as /home and put user 
accounts there.Depends on how many you have, probably.   Although, 
once upon a time /usr  was thought to be a place for user accounts - 
maybe /usr/home actually, nowdays /usr is too important to the
system itself to put user accounts' home directories, which can 
grow unexpectedly sometimes in it, unless you are the only one with
any user accounts, and then you can even surprise yourself sometimes.
 
 Maybe I should just assign ad1 to /home, which is basically the one
 place where I use most disk space?
 
 Oh snap, never mind answering this email. I think that is exactly what I'll 
 do!

OK.  Well, that is what I have been saying, somewhat.
Don't make it ad1, but ad1s1a.   I would suggest fully slicing
and partitioning it (fdisk and bsdlabel) rather than using it
as the so-called dangerously-dedicated disk (eg newfs-ing and mounting
it as just ad1.
 
 And thanks for the replies, Jerry and Andrew.

jerry

 
 -- 
 Sincerely,
 Daniel A. A.
 dienub.org
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Put /usr on a different drive

2007-01-14 Thread Daniel A.

On 1/14/07, Jerry McAllister [EMAIL PROTECTED] wrote:

On Sun, Jan 14, 2007 at 12:08:13AM +0100, Daniel A. wrote:

 Hi,
 I'm wondering if someone could point me in the right direction of
 moving the entire /usr partition to a second hard disk, given that I
 am on an existing (newly installed) install of FreeBSD.

 Also, is it possible to specify something like this during the
 installation itself?

It is quite possible, but not quite as convenient as it could be if
you are not familiar with the installer.



 Any possible google queries, links, articles, et cetera are warmly
 welcomed. I've tried throwing a few keywords at google, but it all
 returns off topic pages.

In the last six months I have posted fairly complete ways of
doing this several times on this list.   It is easy.  I suggest
you look throught the FreeBSD questions archives.   Most of my posts
assume things are being moved to an existing file system, but
the process is the same.

First, you should look at what is using up space in your /usr filesystem.
It may be that something is growing in a way you do no want.
For that, use the  'du'  command something like:
  cd /usr
  du -sk *
Cd in to any directory that seems unreasonable and repeat the du to
narrow things down.

One thing that is often done, but I don't recommend is putting
user accounts and other things that can grow unexpectedly in to /usr.
I make a separate file system for user accounts, generally using
the /home mount point.  I also put /usr/ports in a different file system.

If you finally decide that you do need to add a disk - a very real
possibility - then choose a good quality drive of the same general
type your already have - SCSI, IDE/SATA, SAS - aind physicaly install it.

Boot the machine and look for in dmesg.
It will either show up as dann or adnn  where nn is a device number.
It will be da for SCSI or ad for IDE family.  The first drive will be 0
the second will be 1, etc.Probably your boot drive is 0 and the
one you add will be 1.  If they are IDE then ad0 and ad1.

Next, take a look at the drive with fdisk.  Presuming it is ad1,  do:
  fdisk ad1

It should find the disk and think everything is in slice 1 unless the
disk was formerly used in a different system, in which case it should
see the disk, but stuff may be spread ofer up to 4 slices (occasionally
miscalled partitions).

My examples the new drive is IDE family and is the second disk.
You can make sure everything that might be left on it is effectively
wiped out by doing:
  dd if=/dev/zero of=/dev/ad1 bs=512 count=65

Then, to make the disk usable you need to do an fdisk, bsdlabel and newfs.
Presuming you will use the whole disk for /usr (maybe you will really
want to use it in a more complex way, but the process is essentially
the same) and presuming you don't want to make the drive bootable - and
install an OS on it in a separate root,  then
The fdisk creates the slice table and writes sector 0.
  fdisk -I ad1
writes one single slice containing all the usable space on the drive.

NOTE, although drives are numbered 0-nn, slices are numbered 1-4.
Then you need to create a label in slice 1
  bsdlabel -w ad1s1
creates the initial label - note the additional 's1' to specify the slice.

Now, divide up the slice in to partitions.
In this I am presuming you want a single large partition.
Use the bsdlabel in edit mode.
  bsdlabel -e ad1s1

You will be put in a vi edit session unless you have a different
default editor specified in an environment variable.

That will bring up a screen with the slice label as it currently is.
Ignore all the stuff specifying drive specs.
For one partition, change only one field.
There should be a line starting with 'a:'
Change it so it looks like:
   a:*04.2BSD 2048 16384 32776

Leave the line that starts 'c:' as is.

But, if it doesn't give you an 'a:' line, copy the 'c:' line
and use it and just replace the size field with the '*'
You don't really need to change the fsize, bsize and bps fields, but
suggest you make them as I have them above.

Then you have to create a file system on that partition.
Do that with newfs.

newfs /dev/ad1s1a

Newfs needs the full device spec as above.

now you can mount and write to the filesystem.
I'd suggest you do this next stuff in single user mode, but
it isn't absolutely essential.
Make a temporary mount point and mount it.
  mkdir /newusr
  mount /dev/ad1s1a /newusr

Copy the existing /usr to the new space, probably using tar
I use an interim file, but you can use pipes.
If your current /usr is really a whole partition in and of itself,
then I would use dump/restore instead of tar for this
  cd /usr
  tar cvpf /newusr/usr.tar *
  cd /newusr
  tar xvpf usr.tar

The 'v' flag is not essential, but gives you the confidence
something is happening.

Using dump/restore instead of tar, do:

  cd /newusr
  dump 0af - | restore -rf -

Now, get rid of the old /usr and make it use the new one.

  cd /
  mv usr oldusr
  umount /newusr

Put /usr on a different drive

2007-01-13 Thread Daniel A.

Hi,
I'm wondering if someone could point me in the right direction of
moving the entire /usr partition to a second hard disk, given that I
am on an existing (newly installed) install of FreeBSD.

Also, is it possible to specify something like this during the
installation itself?

Any possible google queries, links, articles, et cetera are warmly
welcomed. I've tried throwing a few keywords at google, but it all
returns off topic pages.


Sincerely,
Daniel A.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Put /usr on a different drive

2007-01-13 Thread Andrew Pantyukhin

On 1/14/07, Daniel A. [EMAIL PROTECTED] wrote:

Hi,
I'm wondering if someone could point me in the right direction of
moving the entire /usr partition to a second hard disk, given that I
am on an existing (newly installed) install of FreeBSD.


First, you need to copy all the stuff over. You can
use dump(8)/restore(8), or mount /usr read-only, new
/usr read-write (under a temporary mount point like
/mnt) and use tar(1), cpio(1L), or cp(1).

Then it's just a matter of unmounting /usr and
mounting your new device under this mount point.
Don't forget to edit the fstab(5) entry.


Also, is it possible to specify something like this during the
installation itself?


Just partition your second drive and define any
mount point on any of it's partitions - everything
will be fine.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Put /usr on a different drive

2007-01-13 Thread Jerry McAllister
On Sun, Jan 14, 2007 at 12:08:13AM +0100, Daniel A. wrote:

 Hi,
 I'm wondering if someone could point me in the right direction of
 moving the entire /usr partition to a second hard disk, given that I
 am on an existing (newly installed) install of FreeBSD.
 
 Also, is it possible to specify something like this during the
 installation itself?

It is quite possible, but not quite as convenient as it could be if
you are not familiar with the installer.


 
 Any possible google queries, links, articles, et cetera are warmly
 welcomed. I've tried throwing a few keywords at google, but it all
 returns off topic pages.

In the last six months I have posted fairly complete ways of
doing this several times on this list.   It is easy.  I suggest
you look throught the FreeBSD questions archives.   Most of my posts
assume things are being moved to an existing file system, but
the process is the same.

First, you should look at what is using up space in your /usr filesystem.
It may be that something is growing in a way you do no want.
For that, use the  'du'  command something like:
  cd /usr
  du -sk *
Cd in to any directory that seems unreasonable and repeat the du to
narrow things down.

One thing that is often done, but I don't recommend is putting
user accounts and other things that can grow unexpectedly in to /usr.
I make a separate file system for user accounts, generally using
the /home mount point.  I also put /usr/ports in a different file system.

If you finally decide that you do need to add a disk - a very real
possibility - then choose a good quality drive of the same general
type your already have - SCSI, IDE/SATA, SAS - aind physicaly install it.

Boot the machine and look for in dmesg.
It will either show up as dann or adnn  where nn is a device number.
It will be da for SCSI or ad for IDE family.  The first drive will be 0
the second will be 1, etc.Probably your boot drive is 0 and the
one you add will be 1.  If they are IDE then ad0 and ad1.

Next, take a look at the drive with fdisk.  Presuming it is ad1,  do:
  fdisk ad1

It should find the disk and think everything is in slice 1 unless the
disk was formerly used in a different system, in which case it should
see the disk, but stuff may be spread ofer up to 4 slices (occasionally
miscalled partitions).

My examples the new drive is IDE family and is the second disk.
You can make sure everything that might be left on it is effectively
wiped out by doing:
  dd if=/dev/zero of=/dev/ad1 bs=512 count=65

Then, to make the disk usable you need to do an fdisk, bsdlabel and newfs.
Presuming you will use the whole disk for /usr (maybe you will really
want to use it in a more complex way, but the process is essentially
the same) and presuming you don't want to make the drive bootable - and
install an OS on it in a separate root,  then
The fdisk creates the slice table and writes sector 0.
  fdisk -I ad1
writes one single slice containing all the usable space on the drive.

NOTE, although drives are numbered 0-nn, slices are numbered 1-4.
Then you need to create a label in slice 1
  bsdlabel -w ad1s1
creates the initial label - note the additional 's1' to specify the slice.

Now, divide up the slice in to partitions.
In this I am presuming you want a single large partition.
Use the bsdlabel in edit mode.
  bsdlabel -e ad1s1

You will be put in a vi edit session unless you have a different
default editor specified in an environment variable.

That will bring up a screen with the slice label as it currently is.
Ignore all the stuff specifying drive specs.
For one partition, change only one field.
There should be a line starting with 'a:'
Change it so it looks like:
   a:*04.2BSD 2048 16384 32776

Leave the line that starts 'c:' as is.

But, if it doesn't give you an 'a:' line, copy the 'c:' line
and use it and just replace the size field with the '*'
You don't really need to change the fsize, bsize and bps fields, but
suggest you make them as I have them above.

Then you have to create a file system on that partition.
Do that with newfs.

newfs /dev/ad1s1a

Newfs needs the full device spec as above.

now you can mount and write to the filesystem.
I'd suggest you do this next stuff in single user mode, but
it isn't absolutely essential.
Make a temporary mount point and mount it.
  mkdir /newusr
  mount /dev/ad1s1a /newusr

Copy the existing /usr to the new space, probably using tar
I use an interim file, but you can use pipes.
If your current /usr is really a whole partition in and of itself,
then I would use dump/restore instead of tar for this
  cd /usr
  tar cvpf /newusr/usr.tar *
  cd /newusr
  tar xvpf usr.tar

The 'v' flag is not essential, but gives you the confidence
something is happening.

Using dump/restore instead of tar, do:

  cd /newusr
  dump 0af - | restore -rf -

Now, get rid of the old /usr and make it use the new one.

  cd /
  mv usr oldusr
  umount /newusr
  mount /dev/ad1s1a /usr

Check everything out and