Cimi’s Official Blog

Italians do it Better…

Just a Blog on Gtk+ Theming, Bleeding-Edge, Good Software...

Super-Silent Mediacenter on an USB disk/pendrive! 10 September, 2008

This is more a help post, rather than new code :)

The idea is simple: I want to get rid of all my hard disk noise, dvd drive (etc…) by running the system from an USB pendrive.

It will be fantastic, because your mediacenter applications (elisa, mythtv, mplayer…) will be loaded from the USB device in absolute silence.

The easier solution would be booting from an USB device if your bios supports it: unfortunately, PCs used as mediacenters are generally quite old and “boot from usb” is not supported.

Now comes two different hypothesis:

  1. Install GRUB into the HDD, then run /dev/sdb (USB device). I’m not sure GRUB supports it.
  2. Run initrd and kernel from the HDD, then mount the pendrive as root / partition.

…and maybe a third, if you have some ideas :)

Do you know how to manage/install that correctly, could you help me? :)

Spread the Voice!
  • Digg
  • Slashdot
  • del.icio.us
  • Technorati
  • Google

Posted in English, Multimedia |

19 Replies

  1. luca said:

    I was thinking about a permanent ramdisk if you have enough ram :)

  2. Bob said:

    This would be hell slow. You can try to boot on a CompactFlash with a CF->IDE adaptator too. There are some interesting double adaptator here  : http://www.addonics.com/products/flash_memory_reader/ad44midecf.asp (30USD)

  3. oliver said:

    Just a note about booting from USB: I had bought a VIA Epia board for experimenting with mediacenter software, and tried to boot from USB. It works, but is _really_ slow… I had expected it to be faster than a hard disk, but in fact it was much slow. Might be a BIOS issue…

    Btw. another way could be to use a CF flash card and a CFIDE adapter (apparently CF cards use the IDE protocol internally, so adapters are simple and cheap). That way, the flash card would be detected as normal hard disk by the BIOS.

  4. oliver said:

    (well… what Bob said :)

  5. cosimoc said:

    +1 for the CF->IDE adaptor, I think that’s the easiest and fastest way.

  6. Qball said:

    +2 for the cf->ide adaptor, and get a 300x flash card, they are somewhat more expensive. But very fast.

  7. Cimi said:

    +3 for the cf->ide adaptor, just bought for 0,99€ on ebay :)

  8. bautz said:

    Third: use a bootstrap cd like the faunos one:
    -insert the usbkey and the bootstrap cd (is a 6 mb: it let you boot from the usb key)
    -power on the pc
    -the system load ENTIRELY from uskey (after grub you can (if you want) remove the cd) and run totally in ram

    Advantages? You can use an old pc without any harddisk

    To create your personal usb linux distribution I suggest you to use Larch (if you love Arch, you will love Larch).
    It’s easy, it’s based on arch, you can install whatever program you want, it run in ram (your log and similar won’t destroy your usbkey), once you shutdown it saves the changes to the key.
    From startup to shutdown, it writes only ONE time on the usb key.
    A standard installation on a usb key (that is possible), will harm your usbkey

    I hope it will be useful

  9. Evan said:

    I’ve tried a couple of the CF->IDE adaptors, and none of them worked. Hope the one you got off eBay works, but if not, how about one of these: http://www.logicsupply.com/categories/flash_memory

    I am using the 1GB SATA one for a project with an Intel D945GCLF, and it works brilliantly. $75 USD for board/CPU, $30 for RAM, and $50 for the storage = fairly complete system for just over $150.

  10. Cimi said:

    @8:
    how about a bootstrap using the HDD?

  11. fabiand said:

    Give the client enough ram and trie pxe booting the whole thing.

  12. drag said:

    Basic howto make a USB drive that boots from most anything:

    1. Obtain a USB flash drive of 2gigs or better. 8gigs is golden and about 50-60 bucks.

    2. Pop the USB key into Linux. Unmount the usb drive since Gnome likes to automount stuff.

    If this drive has been used for bootable systems in the past then be sure to use DD to wipe out the beginning of the drive with zeros. This is because we absolutely do NOT WANT ANY bootloader in the MBR.

    3. Use mkdiskimage to create a ‘geometry’ that matches that of ZIP drives.

    mkdiskimage /dev/sdz 0 64 32

    4. Use cfdisk to delete the partition of the drive. Make two partitions and give them volume labels for later identification. Assuming your system’s name is going to be ‘mediamaster’

    partition one is about 50MB and marked ‘bootable’ and ‘fat32′ type by cfdisk.
    partition two consumes the rest of the drive, marked as a ‘linux’ type.

    Use mkfs.msdos to create the file system on the first partition. Give it the volume name of “mmBoot” (for mediamaster)

    Use mkfs.ext3 to create the file system on the second partition.
    Give it the volume label of ‘mmRoot’.

    The volume labels will be used to identify them in the boot configuration and in /etc/fstab

    5. Use KVM or Qemu (with Kqemu accelerator) to install Debian on the USB drive.

    kvm -hda /dev/sdz -cdrom LennyBeta2.iso

    Choose the non-graphical installer (it’s nicer).

    Install Debian as you normally would. The only differences are:
    * Don’t setup the first partition as /boot. We will take care of that as later.
    * Don’t setup a swap. We can use a swap file later if needed.
    * Don’t install a bootloader. Exit out of that and choose the ‘finish without installing the bootloader option’.

    I strongly suggest setting up a apt-proxy or approx proxy services for your installations. This can work for Ubuntu also. This will dramatically speed up install times if you have multiple machines.

    6. Remove the drive from the machine. Plug it back in. Gnome should automount it. Mount it manually if not.

    Copy /boot/vmlinuz- on your mmRoot volume to the root of mmBoot. Name it simply ‘vmlinuz’

    Copy /boot/initrd- on your mmRoot volume to the root of mmBoot. Name it ‘initrd.img’.

    7. Edit /etc/fstab on mmRoot so that instead of root being /dev/hda1 you are using LABEL=mmRoot

    It’ll look something like this:
    LABEL=mmRoot / ext3 defaults,noatime 0 1

    Commit out the cdrom. Add a entry for mmBoot if you want. Don’t cover up /boot with it tho…

    8. On mmBoot create the syslinux.cfg configuration file:

    DEFAULT linux

    LABEL linux
    KERNEL vmlinuz
    APPEND initrd=initrd.img rootdelay=5 root=LABEL=mmRoot ro

    9. Umount mmRoot; umount mmBoot

    10. Install syslinux bootloader on mmBoot

    syslinux /dev/sdz1

    11. Test with KVM/Qemu and make sure the system is bootable and the initrd can find the volume names.

    kvm -hda /dev/sdz

    And that should be about that. It may take some fiddling around with initramfs configuration files if your unlucky, but it should work pretty well. The rootdelay option gives the system time to detect all the usb stuff.

    It can be bootable now by using regular USB-HDD option or USB-ZIP emulation. This isn’t suppose to be the ‘correct’ way to make a large disk USB-ZIP bootable, but it works for the vast majority of machines.

    Even old machines support USB-ZIP. It would have to be a very old system to not support that.

    Some BIOSes, especially laptops, may lack the option to make USB-ZIP. But usually they’ll support it anyways. Sometimes putting ‘removable devices’ in front works. Other times there is a boot menu you can access that will let you choose devices on the fly.

    Other times you will have to simply make all other boot types fail and it’ll try USB-ZIP as a last ditch effort. I had to do this on a T40 Thinkpad a while ago.. required the removal of the harddrive which is a PITA.

    There are all sorts of fancy things you can do to make your system look much more clever.

    I suggest installing Splashy and adding a splash menu.

    Also, unlike older documentation you can find on the web, the ‘menu’ extension for syslinux does support full color png and jpeg graphics. So you can give yourself a splash screen for your bootloader also.

  13. Russ said:

    Another vote for the CFIDE adapter. I use this run my mythfrontend and my shorewall router. Be careful when buying the adapter though, make sure it supports UDMA/66.

    Adapter, $12.99
    http://www.newegg.com/Product/Product.aspx?Item=N82E16812186034

    266X 2GB flash card, $21.49
    http://www.newegg.com/Product/Product.aspx?Item=N82E16820208296

  14. Cimi said:

    I have bought this one, it supports DMA-33, I hope it is enough:
    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&ssPageName=STRK:MEWNX:IT&item=160279259833

  15. foo said:

    How about switching the BIOS to coreboot?

  16. Mikael said:

    I am booting my htpc from usb and the bios adds a 30s delay before grub gets loaded, really annoying. I am going to go the sata of ide flash route.

    Oh, and if you try to run mythtv and have it write the livetv ringbuffer to the usb flash it will be too slow to be bearable. Atleast on a corsair flash voyager.

  17. Gabriele said:

    I’ve got a well solutions by using an hard-disk Seagate. This manifacturer buids ultra silent hard-disks.

    In example: my hard disk, succesfully used in my media-center, is really noiseless, I only realize that it work if I put above it my ear.

    The second choise I suggest to you is to buy a Samsung.

  18. Matteo said:

    Una Cf è la scelta migliore imho, anche dal lato economico, oramai una CF da 16GB con una discreta velocità in lettura ti costa meno di 50€, oppure anche un hdd usb potrebbe andare no?

  19. Chris said:

    Just compile the entire linux OS into an initramfs in your kernel. You’ll get a huge kernel, but many of the issues about booting USB go away, as long as your BIOS can boot from the device, you don’t have to try and find where the root disk is anymore.

    Then mount a unionfs over the top of this, save all your changes in a different branch and overlay this on top of the kernel OS image next time you boot.

    Reduces the problem of trying to find a root disk in a partial environment, to just mounting a USB partition in a full running OS. A much simpler problem. You need to have at least enough physical RAM to uncompress the initial OS for this to work though, but generally not a problem today when several GB is the norm.

    Initrd’s suck. Don’t use them if you can help it. Initramfs is the future.

    BTW, +1 to foo for suggesting coreboot. Unfortunately, it will be a cold day in He!! before Intel releases enough info on their chipsets to support it, so unless you can run AMD, it won’t work. Too bad really…a great project.

Leave a Comment

Attention: Moderation is enabled, and could cause a delay to the posting.

This blog is "Powered by Cimi"

Theme from: Kaushal Sheth | Modified by: Andrea Cimitan