secondary hdd

Jerry McAllister jerrymc at msu.edu
Mon Jul 30 21:12:59 UTC 2007


On Mon, Jul 30, 2007 at 01:20:31PM -0700, Cyrus wrote:

> ok, i origainly had windows xp pro on my machine, i installed freebsd 6.2.
> my machine has a 40gb seagate disk for o/s, and a 160 gb WD disk for
> storage.
> 
> my question is, how do i go about formating the 160 gb, from ntfs to ufs for
> use in freebsd?  and make it automount when system boots?

That is pretty well documented in the handbook, FAQs and online 
publications.

A brief rundown is:
  You don't have to literally "reformat" it.   That is a low level
  process done at the factory and normally not redone.   But, we
  know what you mean - you want to do whatever is necessary to use
  it in FreeBSD and don't care what the process is actually called.

NOTE:  If it is SCSI the name is da1:  if IDE/SATA it is probably ad1:

ALSO NOTE:  I am presuming you do not intend to make this disk bootable.
            If you do, add a -B flag to the fdisk and to the first bsdlabel

NOTE too:  This all must be done as root.

  First:  use fdisk to create one slice (da1s1) of FreeBSD type on it that
    occupies the whole disk.
      dd if=/dev/zero of=/dev/da1 bs=512 count=1024
      fdisk -I da1
    the dd wipes out old stuff.  It might not be needed, but is easy
    just to make sure.

  Second:  use bsdlabel to write the partitions in that slice.  Partition
    layout Depends on how you want to use it.  For example, I will use
    one chunk of extra swap and two mountable partitions d & e.
      bsdlabel -w da1s1          [this puts the base label there]

      bsdlabel -e da1s1          [this puts you in mode to edit partitions]
    you will then see something like this:

  8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
    c:335544320        0  unused       0     0      # "raw" part, don't edit

    Edit it to look something like:
    
  8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
    b:  2097162        0    swap
    c:335544320        0  unused       0     0      # "raw" part, don't edit
    d: 33554432        *  4.2BSD    2048 16384     8
    e:        *        *  4.2BSD    2048 16384 28552
    
This will give you a 1 GB swap partition, a 16 GB da1s1d partition
and a da1s1e partition that takes up all the rest of the disk.

NOTE:  The numbers under size and offset are in 512 byte blocks.
       You can use values like 16GB, but this was is consistent.
NOTE too:  When you use * for offset and the final size, bsdlabel
           calculates them for you - correctly.   But you can specify
           them yourself if you want - if you are doing something weird
           like leaving a hole in the middle or whatever.

  Third:  You must run newfs on the two mountable partitions
      newfs /dev/da1s1d
      newfs /dev/da1s1e
        Nowdays the defaults are generally good for most usages, but there
        may be times you need to adjust them to get more inodes if you
        have a large filesystem with lots of vary small files.

NOTE:  newfs seems to want the full device name still, even though fdisk
       and bsdlabel now will fill in if you just give them da1  without /dev.

  Fourth:  You must create mount points for the mountable partitions.
           Say you want to mount them as /work and /scratch, then
             mkdir /work
             mkdir /scratch

  Fifth:  You must edit /etc/fstab to add lines for each of the three
          new partitions.  The swap should look like your existing swap
          line with the new device name, something like:
            /dev/ad0s3b       none         swap    sw        0       0
          The mountable partition should look about like one of the
          other mountable partition lines but with the new names:
            /dev/da1s1d       /work        ufs     rw        2       2
            /dev/da1s1e       /scratch     ufs     rw        2       2

Thereafter, it should all work just fine and dandy.   Again, note,
these examples are for SCSI.  For IDE/SATA the device names would 
be ad....  in place of da....
  such as bsdlabel ad1s1  and  /dev/as1s1d  for mounts.

The documentation is quite complete on this.  You should do
some reading.

////jerry

> 
> Thank you
> Cyrus
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list