# How to add 40GB HDD to IBM PII with freebsd8



## JimmY_BL (Jun 21, 2010)

Hello everyone 
On my balcony i have an IBM PII machine with Freebsd8 on it working excellent with UpTime of 2 years 
This is my new problem ... freebsd system is on 20GB IDE hard disk, and is almoust full ... and i want to add one more old IDE HDD which have 40GB of memory
I plugged in the second HDD (which have 2 DOS partitions) and the bsd is up ... when i run sysinstall it`s asking me if i`m sure what geometry that hdd use (is it similar to BIOS geometry) ... i dont know what to do, so i didnt go further :-S
now i tried using gpart command like this: 


```
terminator# gpart destroy ad1
gpart: Device busy
```

and then i want to see whats on the disk - does bsd see partitions on it:


```
terminator# gpart show ad1
=>      63  78165297  ad1  MBR  (37G)
        63  32772537    1  !12  [active]  (16G)
  32772600  45383625    2  !15  (22G)
  78156225      9135       - free -  (4.5M)
```

I dont know how to use other commands for disk slice and label ... so i`m asking you for your help 
So, please, can someone help me with this,STEP BY STEP, to make my second HDD works with this installation of freebsd - i want to use this disk just for one user (all 40GB) and that the mount point be /home/thatoneuser ?

Tnx in front !


----------



## roddierod (Jun 21, 2010)

I assume it's just a data drive.
try this:

```
# dd if=/dev/zero of=/dev/da1 bs=1k count=1
# bsdlabel -Bw da1 auto
# bsdlabel -e da1               # create the `e' partition
# newfs /dev/da1e
```
from here http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html


----------



## JimmY_BL (Jun 21, 2010)

i already tryed that command ... and this is what i get:


```
terminator# dd if=/dev/zero of=/dev/ad1 bs=1k count=1
dd: /dev/ad1: Operation not permitted
```


----------



## JimmY_BL (Jun 21, 2010)

and this is what i have in /dev dir ... :


```
terminator# cd /dev/
terminator# ls
acd0
acd1
ad0
ad0s1
ad0s1a
ad1
ad1s1
ad1s2
ad1s5
agpgart
ata
atkbd0
audit
```

i deleted some things in this quote, because it`s not important ...


----------



## JimmY_BL (Jun 21, 2010)

Last edited by DutchDaemon; Today at 19:28. Reason: proper formatting: http://forums.freebsd.org/showthread.php?t=8816 

sorry, i notice this just now ... i will put it in code in the future


----------



## fronclynne (Jun 21, 2010)

Do you have something that automounts drives active, like hald/dbus?  You need to make sure that your dos partitions are not mounted before FreeBSD will let you modify the hard drive.


----------



## JimmY_BL (Jun 21, 2010)

no - i dont use anything like that ... i dont know  i only have bsd on this machine, and this is what bsd runs:

```
terminator# ps x
  PID  TT  STAT      TIME COMMAND
    0  ??  DLs    0:00.07 [kernel]
    1  ??  ILs    0:00.07 /sbin/init --
    2  ??  DL     0:01.62 [g_event]
    3  ??  DL     0:01.33 [g_up]
    4  ??  DL     0:01.45 [g_down]
    5  ??  DL     0:00.00 [xpt_thrd]
    6  ??  DL     0:00.16 [fdc0]
    7  ??  DL     0:00.00 [sctp_iterator]
    8  ??  DL     0:00.04 [pagedaemon]
    9  ??  DL     0:00.00 [vmdaemon]
   10  ??  DL     0:00.00 [audit]
   11  ??  RL   174:49.71 [idle]
   12  ??  WL     0:24.00 [intr]
   13  ??  DL     0:01.42 [yarrow]
   14  ??  DL     0:00.21 [usb]
   15  ??  DL     0:00.00 [pagezero]
   16  ??  DL     0:00.26 [bufdaemon]
   17  ??  DL     0:00.79 [syncer]
   18  ??  DL     0:00.18 [vnlru]
   19  ??  DL     0:00.19 [softdepflush]
   20  ??  DL     0:00.03 [flowcleaner]
  107  ??  Is     0:00.00 adjkerntz -i
  425  ??  Ss     0:00.01 /sbin/devd
  551  ??  Ss     0:00.21 /usr/sbin/syslogd -s
  569  ??  Ss     0:00.08 /usr/sbin/rpcbind
  808  ??  Ss     0:01.05 /usr/local/sbin/httpd
  832  ??  Ss     0:00.74 /usr/sbin/sshd
  841  ??  Ss     0:00.14 /usr/sbin/cron -s
 1712  ??  Ss     0:00.32 sshd: jimmy [priv] (sshd)
  896  v0  Is+    0:00.02 /usr/libexec/getty Pc ttyv0
  897  v1  Is+    0:00.02 /usr/libexec/getty Pc ttyv1
  898  v2  Is+    0:00.01 /usr/libexec/getty Pc ttyv2
  899  v3  Is+    0:00.01 /usr/libexec/getty Pc ttyv3
  900  v4  Is+    0:00.01 /usr/libexec/getty Pc ttyv4
  901  v5  Is+    0:00.01 /usr/libexec/getty Pc ttyv5
  902  v6  Is+    0:00.01 /usr/libexec/getty Pc ttyv6
  903  v7  Is+    0:00.01 /usr/libexec/getty Pc ttyv7
 1718   0  S      0:00.05 su
 1719   0  S      0:00.08 _su (csh)
 1723   0  R+     0:00.01 ps x
```


----------



## wblock@ (Jun 21, 2010)

JimmY_BL said:
			
		

> i already tryed that command ... and this is what i get:



Make very sure you're writing to the correct disk.
You must be root.
No partitions on the target drive mounted.

You may also need to turn off the safety:`# sysctl kern.geom.debugflags=16`


----------



## JimmY_BL (Jun 21, 2010)

My primary HDD is ad0 - where the freebsd is installed;
I laways use su command to gain root access;
There is no active or mounted partitions (only 2 old DOS partitions i never used) on the secondary drive ad1;
i tried that command when i was using sysinstall ... and the same things is happening


----------



## fronclynne (Jun 21, 2010)

If all else fails, rebooting into single-user mode might help.  You'll have to mount /usr manually, most likely to have access to dd(1) and the like.


----------



## JimmY_BL (Jun 22, 2010)

i want to try the single-user mode but i cant because i dont have a screen for that machine ... i access the bsd over the ssh on my laptop 
but i did find a some other way to make bsd partition on that drive - i opened the box, take out the drive, connected him to laptop with HDD cage and run the win program - now i have that drive with bsd partition on him ... 
please tell me what i must to put in /etc/fstab to have that drive automount on boot with mount point to /home/user ?


----------



## fronclynne (Jun 22, 2010)

Ah, if possible use either glabel(8) or pass [red]-L _labelname_[/red] to newfs(8) so you don't have to worry about device number changes.

Otherwise, it's probably something like 
	
	



```
/dev/ad1s1a /home/user ufs rw 2 3
```

Though you might want to make sure of your device number.  Also see fstab(5).


----------



## JimmY_BL (Jun 22, 2010)

tnx for that line in fstab, i have the similar line for my primary drive ... 
i learned one new thing 

can you tell me what did i do wrong with this 


```
terminator# gpart create -s GPT ad1
ad1 created
terminator# gpart add -t freebsd-ufs ad1
ad1p1 added
terminator# gpart show ad1
=>      34  78165293  ad1  GPT  (37G)
        34  78165293    1  freebsd-ufs  (37G)

terminator# newfs -U /dev/ad1p1
newfs: /dev/ad1p1: failed to open disk for writing
```


----------



## fronclynne (Jun 23, 2010)

Total shot in the dark, but are you sure you connector & cable are good?  "failed to open disk for writing" sounds eerily similar to "device not ready".  Is there anything in /var/log/messages about /dev/ad1 or /dev/ata?


----------



## roddierod (Jun 23, 2010)

You wouldn't happened to try the newfs command after adding the line to fstab and rebooting?
That be my guess.


----------



## JimmY_BL (Jul 18, 2010)

roddierod said:
			
		

> You wouldn't happened to try the newfs command after adding the line to fstab and rebooting?
> That be my guess.



HELP!!! I put the line in my fstab file, and then i rebooted my comp, after that he boots and outputs error and goes to single user mode (read-only file system) and now i cant change back my fstab file and boot the system up !
The error is like this:


```
THE FOLLOWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY:
ufs: /dev/ad1p1 (home/zrile)
unknown error, help!
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
/bin/sh on /etc/rc terminated abnormally, going to single user mode
```

Please help me ... i need my bsd box because the users who hosted their sites on my machine is angry :-S


----------



## DutchDaemon (Jul 18, 2010)

```
fsck -y 
mount -u / 
mount -a -t ufs 
swapon -a
```

Edit fstab.


----------



## JimmY_BL (Jul 18, 2010)

tnx a lot, you are the best ... i used this command and accessed the fstab without problem, and when i used mount -u command i finally found problem with my other drive 
he puts the mount point to /usr/home/zrile and not only to /home/zrile ... it was my mistake from the begining 
now i put the mount point and label correctly and have access to both my hard drives 

you can lock the thread ...


----------

