Saturday, August 13, 2011

As-Is, Not Everything I Do Works Out As I Had Hoped

So, putting my file server on a VM did not have the outcome I was hoping.

But, I did do a few cool things that may save someone else a few minutes and some hair pulling. So, some of the steps I took access to the raw disks from a VM are provided below as-is. So, my notes are presented unformatted as such below.


My old fileserver with all my most treasured files was highly under utilized. So the plan was to move it to a virtual machine host.
This begged giving a OpenIndiana VM access to raw disks for zpooling (and maybe raid-z when I get better hardware for the house).

I backed up my files and started with empty platters on my spindles.


Step 1 Attach two physical disks to the host machine which become the storage mediums of the upcoming zpool.
no partitions - don't make any or get rid any preexisting

My Debian Host OS recognized the new drives as /dev/sdb & /dev/sdc and we will not mount and/or prevent mounting them.



Everything else will be easiest to accomplish as the root user.

su



brad will be the user VirtualBox will be running under
change the ownership and mode of the device nodes to allow ufettered access by the user running VirtualBox

chown brad /dev/sdb
chown brad /dev/sdc

chmod 775 /dev/sdb
chmod 775 /dev/sdc



Add the user of the VirtualBox process to the disk group

sudo usermod -a -G disk brad



create the .vmdk files

VBoxManage internalcommands createrawvmdk -filename /home/brad/.VirtualBox/a1.vmdk -rawdisk /dev/sdb -relative
VBoxManage internalcommands createrawvmdk -filename /home/brad/.VirtualBox/a2.vmdk -rawdisk /dev/sdc -relative



change the ownership and mode of the pointer files to allow ufettered access by the user running VirtualBox

chown brad /home/brad/.VirtualBox/a1.vmdk
chown brad /home/brad/.VirtualBox/a2.vmdk

chmod 775 /home/brad/.VirtualBox/a1.vmdk
chmod 775 /home/brad/.VirtualBox/a2.vmdk



log out
log in



add the .vmdk files to your virtual machine via the GUI.



Time to boot the VM.

Yeah, that's it. Fire her up. My username within the OpenIndiana VM will also be brad.



Do whatever administrative things you might do with a new machine.

Set the network connection to a fixed IP. Give good users privileges, take privileges away from bad users-- or the other way around if you desire a little more excitement in your life.



Setting up your first zpool is easiest as root. I am choosing to mount my zpool in a non-standard spot with the -m option.

su
mkdir /export/home/zfs/
zpool create -m /export/home/zfs/ memory mirror /dev/dsk/c1t2d0p0 /dev/dsk/c1t3d0p0



Create filesystems on your zpool that is much like a software RAID 1 volume. Except ZFS cares about the integrity of your data and the effects bitrot.

zfs create memory/photos
zfs create memory/iso
zfs create memory/music
zfs create memory/videos
zfs create memory/misc
zfs create memory/work
zfs create memory/holding

groupadd securftp

usermod -G securftp brad

chgrp securftp /var/zfs/holding

chmod 774 /var/zfs/holding

"My Printer Doesn't Work"

Normally "My Printer Doesn't Work" isn't enough information to give a concise clear answer.


Challenge Accepted


I am going to make a few assumptions...

MS Vista OS, MS Office 2007, and a consumer grade USB Inkjet/Laser printer.

Basics before we do anything.

	Hardware level 

		Power cord plugged in at the printer and the wall?
			Give both ends a gentle tug to make sure they are seated tightly.
		Is the USB cable plugged in at the printer and the computer case?
			Gentle tug at both ends again.

First we are going to make sure that the OS recognizes there is a printer attached.

	Click the 'Start Button' (It is the round button in the lower left.)
	RIGHT CLICK 'Computer' in the second column.
	A context menu will pop up, click 'Properties'.
	A Management Console will pop up.
	Click 'Device Manager' in the left hand column.
		You may neet to allow the action to continue.

	You should see a little directory tree of every hardware device your computer has.
		Many will be gobbldygook devices that you've never heard of.
			PCI Bus... WTF?
		Some, like the keyboard, will be plainly visible and familiar.
		Look for either 'Printers' or 'Universal Serial Bus controllers'
			Is your printer in either of those?

			NO, you need to reinstall the printer with the manufacturer's disk
			 or with a downloaded setup program from the manufacturer's website.

			YES, close all the windows and continue.

Next, since the computer knows your printer exists; we need to make sure it knows to use it.

Let's check to make sure the Operating System has your printer set as the 'default' printer.

	Click the 'Start Button' (It is the round button in the lower left.)
	Click 'Control Panel' in the right hand column.
	A management console type window will pop up.
		You may neet to authorize the action.
	Click 'Hardware and Sound'
	Click 'Devices and Printers' if 'Printers' by itself isn't available.
	Look for your printer, it should have a checkmark.
		If not RIGHT CLICK your printer and cick 'Set as default printer'.
		If it does we'll look in MS Office.
	Close all the windows.

	Open MS Office (Word or Excel)
	Click the 'Windows' type image in the upper left corner.  It is actually a menu icon.
		'Print...' is in there.
			If you use the 'Print...' menu item it will give you printing options.

As a last resort, try 'Windows Update'.
	Click the 'Start Button'.
	Click 'Programs'.
		You should see 'Windows Update'.
		Click it and follow the instructions
		Restart your Computer.
			Rinse and repeat until 'Windows Update' reports no more updates for your computer.

If these instructions fail, you can try ###-953-9738 which is my home number.
But, I will expect a small favor in exchange.
	(Nothing difficult, nothing creepy.  If I were in a movie, I would wear a white hat.)

I was able to learn that the printer was not recognized until the drivers were loaded. Once the drivers were loaded she could print. ...Challenge Beaten

Using nLight to Create Your Own Custom Windows Installs

Background


I have the specific opportunity to build a system specific restore disk on a regular basis. For people I will never see more than once, this issue is nonpoint. But, for people such as me, my close friends and family that may require more than one system restore, as well as the piles of identical machines that have rolled through my workspace; a custom disk would be helpful.


Problem


The restore disks that come with the machines usually install crap in addition to the necessary files and settings. Plain Microsoft Retail Disks often don't have all the drivers the systems require to run properly.


Solution


I've decided to try nLite. Before I can install nLite, I need to install the .NET framework, version 2.0 of the .NET framework at the minimum for nLite version 1.4.9.1 .


Once the initial program requirements are met, it is as simple as installing nLite and running it. The program is very intuitive.


I wanted to use my .iso file instead of going through the trouble of burning a disk. Since nLite won't use .iso files directly (to my knowledge) I need to install a virtual optical drive to mount the .iso image in. I am using a trial version of 'Original CD Emulator', but I will probably try something else next time. You can use a real CD to make it more a more simple process.


I keep several images of my OS install disks handy for backup purposes. In addition to being able to burn new disks to avoid scratching up my originals, I can often use the .iso image file in place of the disk. I used my Microsoft Windows XP Pro SP2 image created with ImgBurn for this. ImgBurn is my favorite tool for working with disks and images. It is a freeware app that has a small footprint and is highly configurable and intuitive. I have looked at the ImgBurn configurations, but I have only used the default settings.


One of the first things it will ask you is for is the location of the files. In this case I have a virtual optical disk making my .iso file pretend to be a legitimate CD-ROM, drive E:\ .


Although not necessary, I decided to slipstream SP3 (WindowsXP-KB936929-SP3-x86-ENU) and an IE security patch (WindowsXP-KB932823-v3-x86-ENU).


It also gave me the option to install hotfixes, add-ons, and update packs. But, I don't have any. So on to the next step.


The feature I am most excited about is adding drivers. When I played with it for the netbooks I worked on, I slipstreamed SATA drivers into the install-- which worked beautifully. This time I want to add the XP networking driver pack available at driverpacks.net and see what happens. It seems like a good idea to check the delete after install box.


When adding all the drivers finished; I added another folder for common programs like the IE8, the Intel SMBus Driver, other driver installers, and sometimes anti-virus intallers.

Automating Windows Driver Installs :(

Background


As a result of needing to reload a sizable quantity of machines with Windows, which really isn't a problem once you know to find the VEN_ and DEV_ information. I wanted to automate the whole process and for some reason I thought I should figure out how the .inf, .drv, .vxd, and .sys files worked with one another. This example just happens to be for the embedded 10/100 Broadcom 440x ethernet device.


Problem


I found a compatible driver on the Dell site like I would any other. But, even though it works-- did Dell put things in there that are tell tale signs that it doesn't belong if anybody were looking? These machines were not my own where certain inconsistencies may not be tolerated. The customers paid a fair price and they deserve a good and polished product.


Another question I asked myself was, "If I streamline the process, can I shave a few seconds off the device install?" Once the .inf file is prepared you still aren't off of the hook if there is no installer with options to install via a script. There is a way to script the install but I had to dig a little to find it.


Solution


Starting with the .inf file I did a lot of reading to figure out what each of the section does.


I renamed the section I wanted in the INF file so that I could use DefaultInstall as the section the OS would choose when I ran rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 E:\ethernet\bcm4sbxp.inf from the command line. This automates the installation of device driver files.


When I was done, I realized that I could have left the section named as the manufacturer had written it and changed my commandline to rundll32.exe setupapi.dll,InstallHinfSection BCM4401NIC 132 E:\ethernet\bcm4sbxp.inf to achieve the same results.


I removed all references to the Dell Computer Corporation.


Just as unnecessary cleanup, I also removed the ASUStek and MCI lines while I was figuring out what all of the stuff in this INF file was doing since it was an eMachines laptop without ASUS or MCI hardware dependent on those lines. When everything was said and done, because it worked without the alternative sections, I did not revert to the original file to add them back in.


The edited file follows below.

;*******************************************************************************
; Copyright 2002 Broadcom Corporation.
;
; INF for 32 bit Windows XP 
;
; History:
;    06/14/02        Inception.
;*******************************************************************************
[version]
Signature	= "$CHICAGO$"
Class=Net
ClassGUID	= {4d36e972-e325-11ce-bfc1-08002be10318}
Provider	= %V_BCM%
Compatible	= 1
CatalogFile=bcm4sbxp.cat
DriverVer=12/17/2002, 3.51.0.0

[Manufacturer]
%V_BCM% = BROADCOM, NTx86.5.1

[ControlFlags] 
ExcludeFromSelect = *

[BROADCOM.NTx86.5.1]

%BCM4401.DeviceDesc%           = BCM4401, PCI\VEN_14E4&DEV_4401

%BCM4401.DeviceDesc%        = BCM4401_broadcom, PCI\VEN_14E4&DEV_4401&SUBSYS_840114e4

%BCM4401.DeviceDesc%     = BCM4401_broadcom, PCI\VEN_14E4&DEV_4401&SUBSYS_00011179

;-----------------------------------------------------------------
; 32-bit Windows XP Install sections.
;  Broadcom  Catch All
[BCM4401.NTx86]
Characteristics	= 0x84			; NCF_PHYSICAL | NCF_HAS_UI
AddReg		= BCM4401AddRegisters, AdvancedTabReg, 8021pPriorityReg, DriverInfo
CopyFiles	= BCM4401.CopyFileNT
BusType		= 5			; PCI bus

[BCM4401.NTx86.Services]
AddService = bcm4sbxp, 2, BCM4401AddService, CommonEventLog

[BCM4401AddService]
DisplayName	= %BCM4401.Service.DispName%
ServiceType	= 1			; %SERVICE_KERNEL_DRIVER%
StartType	= 3
ErrorControl	= 1			; %SERVICE_ERROR_NORMAL%
ServiceBinary	= %12%\bcm4sbxp.sys
LoadOrderGroup	= NDIS

[BCM4401AddRegisters]
HKR,	Ndi,	Service,		0,	"bcm4sbxp"
HKR,	Ndi\Interfaces,	UpperRange,	,	"ndis5"
HKR,	Ndi\Interfaces,	LowerRange,	,	"ethernet"
HKR,	Ndi,	HelpText,		,	%BCM4401_HELP%



;  Broadcom  NIC
[DefaultInstall]
Characteristics	= 0x84			; NCF_PHYSICAL | NCF_HAS_UI
AddReg		= BCM4401_broadcomAddRegisters, AdvancedTabReg, 8021pPriorityReg, DriverInfo
CopyFiles	= BCM4401.CopyFileNT
BusType		= 5			; PCI bus

[BCM4401_broadcom.NTx86.Services]
AddService = bcm4sbxp, 2, BCM4401_broadcomAddService, CommonEventLog

[BCM4401_broadcomAddService]
DisplayName	= %BCM4401_broadcom.Service.DispName%
ServiceType	= 1			; %SERVICE_KERNEL_DRIVER%
StartType	= 3
ErrorControl	= 1			; %SERVICE_ERROR_NORMAL%
ServiceBinary	= %12%\bcm4sbxp.sys
LoadOrderGroup	= NDIS

[BCM4401_broadcomAddRegisters]
HKR,	Ndi,	Service,		0,	"bcm4sbxp"
HKR,	Ndi\Interfaces,	UpperRange,	,	"ndis5"
HKR,	Ndi\Interfaces,	LowerRange,	,	"ethernet"
HKR,	Ndi,	HelpText,		,	%BCM4401_HELP%




;-----------------------------------------------------------------
;
[CommonEventLog]
AddReg = CommonAddEventLogReg

[CommonAddEventLogReg]
HKR,	,	EventMessageFile,	0x00020000,	"%%SystemRoot%%\System32\netevent.dll;%%SystemRoot%%\System32\drivers\bcm4sbxp.sys"
HKR,	,	TypesSupported,		0x00010001,	7

[8021pPriorityReg]
HKR, Ndi\Params\8021pPriority,         ParamDesc,  0, %8021pPriority%
HKR, Ndi\Params\8021pPriority,         default,    0, "0"
HKR, Ndi\Params\8021pPriority\Enum,    "1",        0, %Enabled%
HKR, Ndi\Params\8021pPriority\Enum,    "0",        0, %Disabled%
HKR, Ndi\Params\8021pPriority,         type,       0, "enum"

[AdvancedTabReg]
HKR, Ndi\params\SpeedAndDuplex,       ParamDesc,  0, %SpeedAndDuplex%
HKR, Ndi\params\SpeedAndDuplex,       default,    0, "0"
HKR, Ndi\params\SpeedAndDuplex,       type,       0, "enum"
HKR, Ndi\params\SpeedAndDuplex\enum,  "0",        0, %AutoDetect%
HKR, Ndi\params\SpeedAndDuplex\enum,  "1",        0, %10MbHalfDuplex%
HKR, Ndi\params\SpeedAndDuplex\enum,  "2",        0, %10MbFullDuplex%
HKR, Ndi\params\SpeedAndDuplex\enum,  "3",        0, %100MbHalfDuplex%
HKR, Ndi\params\SpeedAndDuplex\enum,  "4",        0, %100MbFullDuplex%

HKR, Ndi\Params\WakeUpModeCap,       ParamDesc,   0 , %WakeUpMode%
HKR, Ndi\Params\WakeUpModeCap,       default,  0  , "2"
HKR, Ndi\Params\WakeUpModeCap,       type,      0  , "enum"
HKR, Ndi\Params\WakeUpModeCap\enum,  "0",        0 , %WakeUpMode_None%
HKR, Ndi\Params\WakeUpModeCap\enum,  "1",        0 , %WakeUpMode_Magic%
HKR, Ndi\Params\WakeUpModeCap\enum,  "2",        0 , %WakeUpMode_Pattern%

HKR, Ndi\Params\FlowControlCap,       ParamDesc,   0 , %FlowControlMode%
HKR, Ndi\Params\FlowControlCap,       default,  0  , "2"
HKR, Ndi\Params\FlowControlCap,       type,      0  , "enum"
HKR, Ndi\Params\FlowControlCap\enum,  "0",        0 , %FlowControlMode_None%
;   HKR, Ndi\Params\FlowControlCap\enum,  "1",        0 , %FlowControlMode_Rx%
HKR, Ndi\Params\FlowControlCap\enum,  "2",        0 , %FlowControlMode_Tx%
;  HKR, Ndi\Params\FlowControlCap\enum,  "3",        0 , %FlowControlMode_Both%



[DriverInfo]
HKLM,Software\InstalledOptions\%DriverOEM%\%DriverFamily%\%DriverMfgr%\%DriverProduct%,Description,,%DriverDescription%
HKLM,Software\InstalledOptions\%DriverOEM%\%DriverFamily%\%DriverMfgr%\%DriverProduct%,CurrentVer,,%DriverOEMVersion%
HKLM,Software\InstalledOptions\%DriverOEM%\%DriverFamily%\%DriverMfgr%\%DriverProduct%,Ver_%DriverOEMVersion%,,%DriverVersionID%
HKLM,Software\InstalledOptions\%DriverOEM%\%DriverFamily%\%DriverMfgr%\%DriverProduct%,BaseDriverFileName,,%BaseDriverFileName%
HKLM,Software\InstalledOptions\%DriverOEM%\%DriverFamily%\%DriverMfgr%\%DriverProduct%,BaseDriverFileVersion,,%BaseDriverFileVersion%


[DestinationDirs]
DefaultDestDir = 11		; system32 on Win2k and system on win9x
BCM4401.CopyfileNT = 12
BCM4401.CopyFileW9x = 11

[SourceDisksNames]
1=%BCM4401.DiskName%,,

[SourceDisksFiles]
bcm4sbxp.sys=1

[BCM4401.CopyFileNT]
bcm4sbxp.sys,,,1

;-----------------------------------------------------------------
;
[strings]
; Provider
V_BCM = "Broadcom"

; PNP Devices
BCM4401.DeviceDesc = "Broadcom 440x 10/100 Integrated Controller"

BCM4401_HELP = "Broadcom 440x 10/100 Integrated Controller provides local area networking"

BCM4401.Service.DispName = "Broadcom 440x 10/100 Integrated Controller XP Driver"

BCM4401_broadcom.Service.DispName = "Broadcom 440x 10/100 Integrated Controller XP Driver"


BCM4401.DiskName = "Broadcom 440x 10/100 Integrated Controller Install Disk"

SpeedAndDuplex = "Speed & Duplex"
AutoDetect = "Auto"
10MbHalfDuplex = "10 Mb Half"
10MbFullDuplex = "10 Mb Full"
100MbHalfDuplex = "100 Mb Half"
100MbFullDuplex = "100 Mb Full"

8021pPriority = "802.1p QOS"
Enabled = "Enable"
Disabled = "Disable"

WakeUpMode         = "Wake Up Capabilities"
WakeUpMode_Magic   = "Magic Frame"
WakeUpMode_Pattern = "Wake Up Frame"
WakeUpMode_None    = "None"

FlowControlMode         = "Flow Control"
FlowControlMode_Both    = "Rx/Tx Pause"
FlowControlMode_Rx   = "Rx Pause"
;FlowControlMode_Tx   = "Tx Pause"
FlowControlMode_Tx   = "Enable"
FlowControlMode_None    = "Disable"


; Driver Information Entries
DriverMfgr="Broadcom"                                 ; IHV name
DriverVersionID="3.51"                                ; The IHV driver version
BaseDriverFileVersion="3.51"                          ; version of key file
BaseDriverFileName="bcm4sbxp.sys"                       ; Key file for version

; These items will be set by IHV and updated by OEM
DriverOEM="Dell"                                      ; name of the OEM
DriverFamily="NIC"                                    ; device family (NIC, Storage, Video...)
DriverProduct="BCM440X"                               ; Specific Name of device (chipset, for example)
DriverDescription="Broadcom 440x 10/100 Integrated Controller"  ; Description of device (product name, OS or system supported)
DriverOEMVersion="A00"                                ; OEM-specified version

As a note to myself about deleting the output of the find command

find / -name (insert filename parts, wildcards, and/or filename here) -print0 | xargs -0 rm

Followers