# Installation Issues



## SilverJS (Jul 9, 2011)

Guys,

Have not had much luck installing FreeBSD, despite valiant efforts (or so I'd like to think!  =)).

First, had the whole "unable to find device node" or some such error.  Did some research, and what solved it for me was to load geom_bsd, geom_mbr, geom_label and then boot.

But now, I'm getting this error, which is far less documented :

Write failure on transfer!
(write -1 bytes of 1425408 bytes) 100%

When comes time to further the install.  Not sure what has been installed at that point - sysinstall for sure, but not the ports, I don't think - but I can't progress any further.  Just a few details to help you guys :

Asus M4A88T-M
4 GB RAM (Kingston DDR3 1333)
FreeBSD 8.2 RELEASE amd64 via USB

I am in the process of DD'ing the disk I had hoped to use as a system drive (a 500Gb WD drive) to ensure that it's really clean, but I actually had that error on my very first install.  Not sure if it's a 4K drive, but I don't think that matters for the system drive, does it?

Any help would be greatly appreciated.

EDIT : Forgot to mention I already checked the checksums for my USB image.


----------



## SirDice (Jul 12, 2011)

SilverJS said:
			
		

> Write failure on transfer!
> (write -1 bytes of 1425408 bytes) 100%


Sounds like there isn't enough free space.


----------



## SilverJS (Jul 13, 2011)

Hmmm...OK, but I got that error on the very first install...!  Now that FreeNAS is running well, I'll just start a dd command to totally zero the drive I had intended to be the system drive, and just try that again when it's done.  From what I understand, zero-ing a 500GB drive can take a while....


----------



## wblock@ (Jul 13, 2011)

SilverJS said:
			
		

> Hmmm...OK, but I got that error on the very first install...!  Now that FreeNAS is running well, I'll just start a dd command to totally zero the drive I had intended to be the system drive, and just try that again when it's done.  From what I understand, zero-ing a 500GB drive can take a while....



There is usually no practical reason to zero a drive.  Wipe out the MBR, or the first megabyte if you really want.  But the whole drive?  No.

(Unless, of course, you plan at some point to run data recovery and don't want old stuff showing up.  But a decent backup is cheaper and more reliable.)


----------



## SilverJS (Jul 14, 2011)

wblock said:
			
		

> There is usually no practical reason to zero a drive.  Wipe out the MBR, or the first megabyte if you really want.  But the whole drive?  No.
> 
> (Unless, of course, you plan at some point to run data recovery and don't want old stuff showing up.  But a decent backup is cheaper and more reliable.)



But if the install failed due to lack of space, wouldn't zero-ing the drive solve that...?  (Like I said, surprising that lack of space would be the issue, seeing as this was a brand-new drive, but worth trying, I guess...)

What would the dd command be to erase just the boot sector again...?


----------



## wblock@ (Jul 14, 2011)

SilverJS said:
			
		

> But if the install failed due to lack of space, wouldn't zero-ing the drive solve that...?



No.  Space is determined by several things.  In this case, most likely is a too-small FreeBSD partition size.  Change that by defining larger partitions when installing or restoring FreeBSD.  Filesystem-level space is freed with rm(1).



> What would the dd command be to erase just the boot sector again...?



Enable writing to the boot block:
`# sysctl kern.geom.debugflags=16`

(WARNING: make very, very sure you have the right ad or da device here, realizing you wrote to the wrong drive is not fun.)

Write zeros to the boot block:
`# dd if=/dev/zero of=/dev/ad0 bs=512 count=1`

bs defaults to 512, but it's given here anyway to make clear that one 512-byte block is being written to the drive.  The first block is the MBR, the boot code plus the MS-DOS partition table (FreeBSD "slices").  The bsdlabel that defines FreeBSD partitions like ad0s1a, ad0s1d, and so on is the second block first block of the slice.  To erase both the boot block and the bsdlabel, increase count to 2 64.

Having said all that, the default auto sizes for partitions in sysinstall(8) aren't terrible.


----------



## jem (Jul 14, 2011)

wblock said:
			
		

> The bsdlabel that defines FreeBSD partitions like ad0s1a, ad0s1d, and so on is the second block.  To erase both the boot block and the bsdlabel, increase count to 2.



I thought the bsdlabel resided within the first block of the FreeBSD MBR slice, which would traditionally start at block 63*

* Depending on disk geometry and whether slices are being aligned to cylinder boundaries.


----------



## wblock@ (Jul 14, 2011)

jem said:
			
		

> I thought the bsdlabel resided within the first block of the FreeBSD MBR slice, which would traditionally start at block 63*
> 
> * Depending on disk geometry and whether slices are being aligned to cylinder boundaries.



I think you're right.  Now I'm not even sure where I got the idea it was the second block of the disk.  It's the first block of the slice.

All right.  To wipe the MBR and bsdlabel of the first slice (MS-DOS partition):
`# dd if=/dev/zero of=/dev/ad0 bs=512 count=64`


----------



## SilverJS (Jul 14, 2011)

OK - but if I totally zeroed a drive (the actual command was *dd if=/dev/zero of=/dev/ada2*), that will ALSO erase all the boot records and such, correct?

In another note - I gave that command in the FreeNAS shell.  The thing just seems stuck there, even after 24 hours....I wonder if the command is even supported in FreeNAS...?


----------



## wblock@ (Jul 15, 2011)

SilverJS said:
			
		

> OK - but if I totally zeroed a drive (the actual command was *dd if=/dev/zero of=/dev/ada2*), that will ALSO erase all the boot records and such, correct?
> 
> In another note - I gave that command in the FreeNAS shell.  The thing just seems stuck there, even after 24 hours....I wonder if the command is even supported in FreeNAS...?



Using that command on a large drive without increasing the buffer size will go very slowly.  The example sometimes given is emptying a well with a teaspoon.  To go faster, use a larger buffer to reduce the overhead.
`# dd if=/dev/zero of=/dev/ada2 bs=1m`

Even with a large buffer, it'll still take a while, maybe a few hours for a 500G drive.  Another reason to avoid it.


----------



## ulbador (Jul 18, 2011)

GPT stores a backup partition at the end of the disk.  With FreeBSD/FreeNAS, if you want to "dd" a drive to blow away the partition, you have to wipe out the beginning AND end of the drive.

You can zero the whole drive, but that's a waste of time.

So to fix the above problem you have to do something like (primary partition table):

`dd if=/dev/zero of=/dev/theDrive bs=512 count=2`

AND (backup partition table)

`dd if=/dev/zero of=/dev/theDrive bs=512 skip=sectors`

where sectors is the length of your disk as reported in fdisk (usually the big long number), minus 1 or 2. These two commands invalidate the primary AND secondary partition tables in a few seconds and saves the time of zeroing the whole disk.


----------



## SilverJS (Jul 19, 2011)

OK, cool - I'm actually on leave but I'll try that when I get back, thanks.

Now, just confirm that fdisk is a command that I can use in FreeNAS, or do I need to use some Live CD of a Linux distro or something?  (Or, I guess, the emergency shell mode or whatever it's called, in the FreeBSD install....)


----------

