This guide will show you how to install debian completely from scratch on a new hard drive. You may want to do this if you've bricked your MBWE white light or if you want more than the default 2GB root filesystem.
This guide will only work with the white light version and I've only tested it with the 1-disk model, but it will almost certainly work with the 2-disk model as well. If your mybook isn't bricked (yet), then I suggest that you follow this guide on a spare hard drive, because if something goes wrong then you can always just plug the original hard drive back in and keep on running the stock firmware. If you wipe the original hard drive in order to follow this guide, then you're taking a large risk that you'll brick your device!
Please take a look here if you want to install the default WD firmware instead of debain.
You will need to download one of my debian images from this thread (either lenny or squeeze). Then run "mkdir temp; tar xvzf debian-*.tar.gz -C temp/". Now any of the files mentioned in this guide should be located in temp/. Please read the first post in that thread so that you know what you're installing.
After installing, your MAC address will be set to a default value. This is fine if you only follow this guide on one mybook, but if you're a huge fan of the mybook as well as debian, and plan on following this guide more than once, then you'll want to set your own MAC address by editing the first line of /etc/inittab to something like
GM::sysinit:/sbin/modprobe gmac mac_adr=0x00,0x21,0x5d,0xa9,0x21,0x81
and also change your hostname in /etc/hostname. Just make sure the MAC address you choose is valid, or else the ethernet port won't work and you won't be able to ssh in to fix it. Just leave it as the default if you're only using this guide on one device.
This guide uses a GUID Partition Table which, for those of you who don't know, will allow you to use hard drives larger than 2TiB as well as have more than 4 primary partitions. So, if you can get your hands on a 1000TB hard drive, it will work with this guide! If you don't know what a GUID Partition Table is, then don't worry about it.
You can modify the steps in this guide however you want. For example, you can use any partition scheme you want. But if you do change some of the commnds, make sure that you:
- have the root filesystem on a RAID device called /dev/md0, because that's what the bootloader expects
- install the kernel provided (and not the WD one) to make sure it's compatible with the provided kernel modules.
- edit /etc/fstab if you create additional partitions (you don't need to do this if all you do is use different partition sizes to me)
Finally, you'll need to open the case of your mybook and move the hard drive(s) to a Linux PC to follow this guide. Opening the case can be a bit tricky, but there are links to instructions on how to do it at the bottom of this page. Note that opening the case presumably voids your warranty.
So, here are the commands you need to run:
# /dev/sdX indicates the first hard drive, which is the only hard drive in the 1-disk model # /dev/sdY indicates the second hard drive in the 2-disk model. # Make sure you're using the right /dev/sd.. device node or else you might accidentally wipe your PC's hard drive! # become root - all commands need to be executed as root sudo -s # if you have any swap or raid partitions on the hard drive we're about to wipe, run swapoff or mdadm --stop on them swapoff /dev/sd.. # for swap mdadm --stop /dev/md.. # for RAID # if you have any RAID partitions, maybe also zero their superblocks mdadm --zero-superblock /dev/sd.. # clear out any old boot information that already exists on the hard drive - this will wipe the hard drive! dd if=/dev/zero of=/dev/sdX bs=1M count=100 # 2-disk owners, please now run the same command on /dev/sdY # run some commands in parted - type "help" if you've never used parted before parted /dev/sdX (parted) mklabel gpt (parted) mkpart primary 16M 4000M # root filesystem - change 4000M to whatever you want (parted) set 1 raid on (parted) mkpart primary 4000M 4512M # swap space - 512M should be enough (parted) set 2 raid on (parted) mkpart primary 4512M 100% # data parition - make it really big (parted) set 3 raid on (parted) print (parted) quit # 2-disk owners, please now run the same commands on /dev/sdY # If parted tells you the new partition table will only be used after a reboot, then reboot now # write the MBR perl <<EOF | dd of=/dev/sdX bs=512 print "\x00" x 0x1a4; print "\xb2\x80\x00\x00"; print "\xb2\x7d\x00\x00"; print "\x00\x03\x00\x00"; print "\x00" x (0x1b0 -0x1a4 -12 ); print "\x24\x03\x00\x00"; print "\x24\x00\x00\x00"; print "\x00\x03\x00\x00"; EOF # 2-disk owners, please run that command again changing /dev/sdX to /dev/sdY # write the bootloader and whatnot dd if=stage1.wrapped of=/dev/sdX bs=512 seek=36 dd if=u-boot.wrapped of=/dev/sdX bs=512 seek=38 dd if=uImage of=/dev/sdX bs=512 seek=336 dd if=uImage.1 of=/dev/sdX bs=512 seek=8482 dd if=uUpgradeRootfs of=/dev/sdX bs=512 seek=16674 dd if=stage1.wrapped of=/dev/sdX bs=512 seek=32178 dd if=u-boot.wrapped of=/dev/sdX bs=512 seek=32180 dd if=uImage of=/dev/sdX bs=512 seek=32478 # 2-disk owners, you know the drill: please run those commands agian, but this time of=/dev/sdY # if you have the 1-disk model, run the following commands mdadm --create /dev/md0 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX1 missing mdadm --create /dev/md1 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX2 missing mdadm --create /dev/md2 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX3 missing # if you have the 2-disk model, run the following commands instead mdadm --create /dev/md0 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX1 /dev/sdY1 mdadm --create /dev/md1 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX2 /dev/sdY2 mdadm --create /dev/md2 --raid-devices=2 --level=raid1 --run --metadata=0.90 /dev/sdX3 /dev/sdY3 # make filesystems mkfs.ext3 /dev/md0 mkswap /dev/md1 mkfs.xfs /dev/md2 # copy the contents of the root filesystem mkdir /mnt/image/ /mnt/md0 mount -o loop rootfs.arm.ext2 /mnt/image/ mount /dev/md0 /mnt/md0/ cp -a /mnt/image/* /mnt/md0/
I take very little credit for this guide, almost all of the commands were taken from a few scipts included in the WD GPL source code (after untaring /toolchain/1nc_buildenv.tar.gz, they can be found at toolchain/create_package/3TB/)