Sunday, May 20, 2012

Replacing hard drives in a Buffalo Linkstation Duo

I have trouble with the original disks within my Buffalo Linkstation Duo.  The two 500GB original hard drives that came with my drive failed one after another (luckily, not together!).  Be fair to Buffalo, their after sale service is good (well for the first replacement).  Emails were replied promptly - though I have problems with the second replacement, their customer services team is good, but their RMA team is dreadful.  I had waited for over two months for a reply from them.

Anyway, the reason I wrote this post is that I fed up the waiting for the replacement and decided to use two spared 250GB drives I have to safe keep my files.  I need the fail-safe provided by RAID1.

Unfortunately, it is not easy as putting two empty drives into the unit and configure the NAS.  It seems Buffalo stores the OS of the NAS on the hard drive rather than on the drive's ROM.  Hence, if you have replaced both drives, the NAS will not know what to do at the boot time.

If you really need to replace both drives at the same time, you need to use TFTP to transfer essential files to the NAS to make it operative.  Step can be found at: http://forums.buffalotech.com/t5/Storage/FAQ-3-of-5-TFTP-boot-procedure-please-read-this/td-p/68094 .  There is a point you may want to note. You don't need to take the drive off your network. In fact, it is better to keep it in your network as after receiving the necessary files through TFTP for booting, it will try to obtain an IP from your DHCP server.  If the drive is still in your network, it can get an IP from your DHCP server.  All you need to do is to set you PC to the static IP 192.168.11.1 to allow the NAS to locate the files intially.

If everything went well, you should have your Buffalo drive in EM mode, and your PC is at static IP 192.168.11.1 . Now, you can put your PC back to your network, i.e. use your normal IP (from DHCP or a static IP within your subnet).

The next step is to run the firmware updater in debug mode, and the instructions can be found at this video:

http://www.youtube.com/watch?v=Pu4HI6XoSB8

With the debug mode, you can ask the NAS to rebuild the drives partition and put back all necessary files onto the hard drive for normal boot.


Monday, May 14, 2012

SSIS Tips and Tricks

Recently I have got myself involved in developing Sql Server Integrate Services (SSIS) packages.  While I was doing it I had picked up a few tips and tricks that I would like to share here.

First trick is to pass parameters from Job Agent into SSIS.  It is possible to assign values to your package on Agent Job's configuration tool.  Details can be found at:

http://www.buildingmeaning.com/?p=171

For example, if you are a package variable called Subject, then you can set (override) this variable with the steps decribed in the link by adding the property path \Package.Variables[User::Subject].Properties[Value] with the desired value.

Second trick is to connect to your data source setup in your package from Script Task.  For example, if you have a data source called "My Data Source" setup in your SSIS, and you can use it in Script Task by doing:-

SqlConnection conn = Dts.Connections["My Data Source"].AcquireConnection(Dts.Transaction) as SqlConnection;


http://msdn.microsoft.com/en-us/library/ms136018.aspx


Third is actually a tip for preventing SQL injection by using parameterized sql

SqlCommand command = new SqlCommand(commandText, conn);
command.Parameters.Add("@ID", SqlDbType.Int);
command.Parameters["@ID"].Value = customerID;

The above specifics the ID is an integer type, so it can prevent values that is not a valid integer.

Hope you find them useful.