Open Source Software and Linux

Dec 28 2008   3:33PM GMT

Adventures with Linux and external hard drives



Posted by: Xjlittle
Tags:
/boot
bios
external hard drive
Linux

I received a Western Digital 1TB external hard drive for my linux server on Christmas. Way cool! Now I could set up a linux NAS filer and backups for the server and other Linux and Windows machines that we have.

While the linux server was running I plugged the external hard drive into the USB port. Checking DMESG I saw that the machine recognized the external hard drive. Ok, I’m on my way..or so I thought. I rebooted the machine to make sure that the external hard drive was recognized properly on a reboot.

This is where the fun began. The server would not boot past the BIOS. A quick check of Western Digital’s site suggested turning off the legacy usb setting which I did. I also turned on boot on no errors (meaning boot regardless of any errors). Still no luck. Ok I’ve never had much luck with Western Digital products and I’ve spent a couple of hours researching and working on this. I rebooted and tried different BIOS settings so many times that my family told me I was creating my own Denial-of-Service attack since the firewall is housed on this server. By the way I tried the WD external on two Windows machines as well. Only one booted properly with the external hard drive plugged into the USB port.

I checked Fry’s web site to see what other products were available. I saw a Buffalo on there for about $105 on sale. The next day I go over to Fry’s. The hard drive is no longer on sale or at least they don’t show it that way in the computer. I asked the sales guy what else he had. He checked stock and found that he was overstocked on SimpeTech external drives and sold me that one for $105.

I headed home with great expectations of this working. It didn’t. So I checked SimpleTech’s web site. There is not much there. So I started searching for simpletech, linux and boot. I finally ran across an obscure post that said to wipe out all of the partitions that came on the external hard drive an create a bootable partition.

So I plugged the hard drive back into the server and fired up fdisk. I deleted all of the partition on the external hard drive and created a single partition of 200MB.

fdisk /dev/sda
Command (m for help): p
Command (m for help): d
Command (m for help): w

Use the p to print to screen a list of the partitions. Starting with the highest numbered partition keep repeating d until all of them are deleted. Type w to write the new partition table to disk and exit. At the prompt after exiting type

partprobe

You can safely ignore any output to this command including the part about rebooting. Now go back into fdisk on your drive and create a typical boot partition. Linux usually uses about 200MB so that is what we will use. Note that if you use the complete 1TB formatting the partition will take a very long time.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-121601, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601): +200M

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@virtual-host ~]#

Now we need to format the partition and put a boot sector on the drive.

partprobe
mkfs -j -L /boot /dev/sda1
mke2fs 1.39 (29-May-2006)
Filesystem label=/boot
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
50200 inodes, 200780 blocks
10039 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
25 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@virtual-host ~]#

The -j makes it a journaled ext3 file system and the -L creates the label /boot which you can use in /etc/fstab if you were to boot off of this drive. You can label it anything that you want.

Now we need to create a boot partition table on the drive. The partition table from your machine that has the external drive plugged in will do nicely.

[root@virtual-host ~]# dd if=/dev/hda of=/dev/sda bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.003661 seconds, 140 kB/s
[root@virtual-host ~]#

Now try rebooting your machine. You will find that it will reboot or start from a powered down condition. Voila! This is good news!

Out of curiosity I began to wonder if the machine would boot without any partitions or partition table installed. It will-another informational finding.

With that information in hand you could try removing the new partitions first and try rebooting the external hard drive and see if that works. That would save you some time from going through the whole process of installing the boot partition and the partition table. Just follow the instructions above to delete the existing partitions and reboot to see if it works.

I suspect that this would have worked on the Western Digital drive as well. However no amount of searching turned up that particular solution. Only after I did the search with SimpleTech did I run across that information. There are also a ton of posts out there about this problem with the Western Digital external hard drive and very few with SimpleTech. None of the posts that I found for Western Digital external hard drives provided this particular solution. Take that information for what it is worth to you.

-j

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: