Welcome! Log In Create A New Profile

Advanced

Boot Debian or PlugLinux from HD instead of a USB Memory Stick

Posted by Phreon 
Boot Debian or PlugLinux from HD instead of a USB Memory Stick
December 09, 2010 07:10PM
I have believe it is likely that if you have a Dockstar you are going to have a hard disk plugged into it. So why not have the bootable OS on the HD? If you are hacking a Dockstar then its very likely you have used Jeff's terrific install script that seems designed for USB memory sticks. That means you have already modified the onboard nand that now boots to an attached usb memory device or reverts back to the Pogo stuff.

So I, and probably others, are now looking to install (Linux, likely Debian) on a hard disk without redoing the bootloader. I have searched for days and have not been able to find anything that speaks directly to installing common Linux distros (like Debian) to Dockstar hard drive after Jeff's great installer works its magic on the onboard nand. (Why mess with the nand it once it works, right?)

I did manage to install PlugLinux to a drive I partitioned using gparted on my Ubuntu desktop. I used the link

http://www.plugboxlinux.org/index.php5?title=PlugApps:Pogoplug_Setboot

and started about half way down the page where it begins ...

"Install Plugbox Linux

After the new bootloader is installed, you will need to use fdisk to partition a storage device, plug in a 512MB or bigger USB drive. REMOVE ALL OTHER DRIVES. Move everything you need off of the drive and back it all up... "

Just follow their directions. After install the thing boots great.

I still wanted a Debian bootable drive so I partitioned another USB hard drive again on my Ubuntu desktop and totally reran Jeff's install script again, (that does reflash nand), but gets me a Debian hard drive that boots.

FYI,
I made the first partition a primary partition, ext2 with the entire drive except for 526 MB. I made a second partition a primary partition with the 526 MB for Linux Swap.

Now I need to figure out:
Samba (to see the mounted disks on my LAN)
Disk spin down (my drive never stops)
Let the OS know about the swap partition (it does not automagicaly)
Auto-Mount for USB (plug in a new disk and it is there.)
OpenNTP for system time. (Dockstar has no clock but the web does.)
Apache with WebDAV (so you can administer it in a browser)
A uPnP app (so I can share media everywhere.) (Minidlna maybe?)
Torrent thingy

Check out:

http://www.plugboxlinux.org/index.php5?title=Ten%28ish%29_steps_to_setting_up_a_Seagate_Dockstar

http://www.rudiswiki.de/wiki/DockStarAutoMountSamba

http://wiki.slimdevices.com/index.php/SqueezePlug#SqueezePlug_Dockstar_Image

http://forums.debian.net/viewtopic.php?f=30&t=47258 (This is a great Debian link.)
Re: Boot Debian or PlugLinux from HD instead of a USB Memory Stick
December 09, 2010 08:30PM
Phreon, I agree: Once I determined that Jeff's uBoot would handle a HD on the Dockstar, I copied everything over to the HD and unplugged the thumb drive. A couple comments: I come from a SheevaPlug background, and there people had all sorts of trouble getting a HD to reliably boot. I think it has something to do with the fact that the SheevaPlug only has one USB port, and thus requires an external USB hub. Thus, on that system, I still use an SDcard for the root partition.

There are some advantages to thumb drives: They are always on, and you never have to wait for them to spin up. Plus, they have no rotational delay, so they are really fast, too, at least on reads. Still, that's not enough to offset the simplicity of having only one HD with everything on it.

Finally, I'd heartily recommend purchasing a Seagate GO drive. They plug right into the top connector and it makes for a super compact and tidy setup. And, this port may get precedence for being the "sda" drive. I don't know for sure, but my GO drive always gets that designation.

As far as converting to a HD, it isn't all that hard. First, it's probably easier to do the conversion on another machine. That way, you don't have to deal with the problems of trying to copy an active file system. I suppose you might be able to do it from the OS on the NAND memory, but I chose to use my Ubuntu desktop.

The following steps should be performed as the root user:

First, plug the HD into your chosen machine, and use the Linux fdisk tool to configure the file systems you desire on the HD. Like on the thumb drive, you'll probably want a root partition and a swap partition. You might want a separate /home. And, you'll definitely want to dedicate most of the drive to a data partition to hold whatever you are planning to store and access from the Dockstar. The partition sizes do not have to match those on the thumb drive. Indeed, it is probably best to give them all a little extra space, given you should have plenty to work with now. Make sure you mark the root partition as being bootable.

Next, perform a mkfs on all the partitions. (Use mkswap for the swap device.) I chose to make mine ext3 file systems. ext3 is more resistant to damage caused by power failures than ext2, and ext4 is so new that lots of older Linux boxes cannot handle it. Even though I made the root partition ext3, it is mounted as an ext2 on the Dockstar, since the Dockstar's uBoot explicitly specifies ext2. I haven't changed that yet, and it's not a problem to do so -- mounting an ext3 file system as ext2 just bypasses the file system logging.

Next, plug in your already populated thumb drive. Depending on which Linux you are running, it may auto-mount the partitions containing file systems. If not mount the root file system somewhere yourself. Then mount the HD file system that is destined to become the new root. Now execute the command
Quote

cd $OLDROOT && find . | cpio -pdm $NEWROOT
where $OLDROOT is the mount point for the thumb drive's root file system and $NEWROOT is the mount point for the HD's root partition.

Do the same for any other populated partitions you have on the thumb drive. When you get done, do a "df" and make sure the space used on each populated HD partition is very close to the space used on the corresponding thumb drive's partition. (It may not be exact.)

You're almost done. On the new HD root file system, edit the /etc/fstab file and make sure that device names are still correct, and any extra partitions you created are accounted for. Then umount everything, unplug the HD, take it over to your Dockstar, and plug it in. If everything goes well, you should be able to power on the Dockstar and it will come up on the new HD, just like the old thumb drive did. If not, you'll have to dig into it with netconsole and/or the serial port, but you can always revert back to the thumb drive in the interim.

Of course, once you verify the HD boots reliably, put the thumb drive on the shelf -- it is now your backup!

Good luck.
Re: Boot Debian or PlugLinux from HD instead of a USB Memory Stick
December 10, 2010 08:01AM
Thanks Restamp,
Your knowledge of Linux is far beyond what I currently know. You have helped point me in directions that allowed me to get this far though.

I now have 2 hard drives and a thumb drive that will boot. They all use parts of Jeff's install as I mentioned earlier. One hard drive is an old 60 GB Toshiba pulled from a dead laptop and plugged in through a cheap ($3.00) Ebay IDE to USB connector. It has PlugLinux on it. The other hard drive I installed last night is another old laptop IDE drive mounted in an old NextStar USB drive enclosure. It has Jeff's Debian-Squeeze install on it. The thumb drive is a very old 1 GB camera SD card that plugs in through a usb card reader. Jeff's Debian install too.

IMHO what would be helpful to a large group of potential users would be a step by step install that adds the basic packages and basic package configuration, that will get a Dockstar on a LAN ready to use as a share. Samba, OpenNTP, Disk spin down, Set swap at a minimum. You may be able to suggest more. A second step would be adding the other stuff like I mentioned above to make it a really useful device. Media, Auto-Mount, Apache with WebDAV, uPnP.

If I ever figure this all out I will post my steps. For now, I am making to many mistakes to advise anyone else. :-)
Re: Boot Debian or PlugLinux from HD instead of a USB Memory Stick
December 10, 2010 06:41PM
Works greate - just one note - when you updating fstab then set partitions to /dev/sda.. and not to /dev/sdc... like it was mounted in the system which I've used to copy files from my pen drive to hdd.
Re: Boot Debian or PlugLinux from HD instead of a USB Memory Stick
December 11, 2010 10:43AM
OK, you have got to try this if you are not a Linux expert!

Install webmin - it allows you to configure your entire system through a web browser.
I mean everything!

http://www.webmin.com/deb.html
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: