Adding and initializing a new disk

Hi,

So I have thoroughly read 18.3 - Adding Disks, and think I've got a pretty good grip on the concept and execution. My question is before that point, which is not explicitly stated in the manual. I have the disk, as purchased, ready to be formatted. When I put it in the drive bay, it is not listed when I use atacontrol. Does the disk need to be attached prior to initializing? Or can I go right into dd=if=/dev/zero... How do I confirm the new disk is in ad6, as I expect it to be?
 
atacontrol should help you. read the manpage.

Code:
man atacontrol

Formatting page, please wait...Done.
ATACONTROL(8)           FreeBSD System Manager's Manual          ATACONTROL(8)

NAME
     atacontrol -- ATA device driver control program

SYNOPSIS
     atacontrol <command> args

     atacontrol attach channel
     atacontrol detach channel
     atacontrol reinit channel
     atacontrol create type [interleave] disk0 ... diskN
     atacontrol delete raid
     atacontrol addspare raid disk
     atacontrol rebuild raid
     atacontrol status raid
     atacontrol mode device
     atacontrol info channel
     atacontrol cap device
     atacontrol list
 
Hi,
This is what it looks like:
Code:
 [root@sc440 ~]$ atacontrol list
ATA channel 0:
    Master: acd0 <PBDS CD-ROM DH-48N1P/AD11> ATA/ATAPI revision 7
    Slave:       no device present
ATA channel 1:
    Master:      no device present
    Slave:       no device present
ATA channel 2:
    Master:  ad4 <WDC WD800JD-75MSA3/10.01E04> Serial ATA II
    Slave:   ad5 <SAMSUNG HD501LJ/CR100-10> Serial ATA II
ATA channel 3:
    Master:      no device present
    Slave:       no device present
[root@sc440 ~]$

The new disk is in the ata3 slot; should I be able to see it here or not?
 
Everything can be done manually with easy

First of all identify your HDD in `atacontrol list` output
Code:
ATA channel 2:
    Master:  ad4 <WDC WD800JD-75MSA3/10.01E04> Serial ATA II
    Slave:   ad5 <SAMSUNG HD501LJ/CR100-10> Serial ATA II
Most probably it will ad5 "Samsung" but make sure by having verified with label on your newly inserted HDD. After that you can start step by step:

1) Completely clear partition table and any othe boot code at the beginig ot disk
Code:
dd if=/dev/zero of=/dev/ad5 bs=1k count=100
2) Initialize whole disk for one slice to entire disk, also this will set boot code
Code:
fdisk -BI /dev/ad5
3) Now set boot code and single partition to whole slice
Code:
disklabel -Bw ad5s1
4.1) Now relabel slice as you need. You can either edit partitions directly from standard input (Ctrl+D to save)
Code:
bsdlabel -BR ad5s1 /dev/stdin
or
Code:
dusklabel -e ad5s1
4.2) or save created at point 3) partitions description to file, edit it by your favorite editor and then restore partitionig from this file
Code:
disklabel ad5s1 > file
/usr/bin/edit file
disklabel -R ad5s1 file
During editing process both as from stdin and from file you'll relabel partition according your needs
Code:
#	size	offset	fstype	[fsize bsize bps/cpg]
a:	1G	16	4.2BSD		# /
b:	2G 	*	swap		# swap
c:	*	*	unused
d:	4G	*	4.2BSD		# /tmp
e:	8G	*	4.2BSD		# /var
f:	*	*	4.2BSD		# /usr
Yes of course this is example. Yo can leave single partition to whole slice or divide it to more partitions adjusting sizes and offsets. Remember don't remove c: partiton which is system and means whole slice. Asterisk (*) means to define offset automatically.

5) Now you can finally format partitions
Code:
newfs /dev/ad5s1a
With softupdates
Code:
newfs -U /dev/ad5s1d
Or with journal
Code:
geom journal load
geom journal label /dev/da5s1f
newfs -J /dev/da5s1f.journal
Add required entries to your /etc/fstab or properly mount partitions manually. Example
Code:
mount -o async /dev/da5s1f.journal /mnt
and make directories hierarchy, copies, backups...
 
Back
Top