First of all, let me start by saying that I'm NOT going to be providing my boot sector to the group. At least not right away. The reason for this is that the boot sector contains the MAC address of MY MBWE2. It's hardcoded, and until I figure out a way to change it, I don't feel comfortable spreading it around. What I will do is let you know how to extract your own boot sector the same way that I did, which everyone should do anyway, and keep it safe until you need it.
Second. I've read through the forums, and used the information contained in it, as well as my own linux knowledge, to restore a bricked MBWE2. Foolish me, when I first got my first MBWE2, I decided to upgrade the firmware, not knowing any better, and it bricked my system, so in my search, I found this site. Anyway, now that I'm older and wiser, I know that I should not upgrade to the 2.x firmware, since it sux.
That being said, most of the data that I have used to restore my MBWE was acquired on this site. If you don't have it, download christof4444's restore images. Though his boot sector is flawed in my opinion, the partition backups are top-notch. Those restore images will be 99% of all that you will need to restore your MBWE2.
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
OK, now that that's out of the way, let me explain how I made the files that I use that differ from the ones that are in christoff4444's images… First of all, in looking at the partition table, it seems that the first partition starts at sector 48195. This seemed strange to me. The howto that christoff4444 put together only backs up the first sector. If that were all that's needed, then WD wasted 48193 sectors of blank space? Not likely…
There's another howto that backs up about 12 megabytes of the beginning of the disk. That breaks out to about 24000 sectors. Closer, but still not quite. That would mean that WD wasted 13-14 megabytes of space for nothing. Again, not likely.
So, being who I am, it seemed to me that to do it properly, I would want to have a backup of the ENTIRE drive. This would include the ENTIRE area that's between the beginning of the disk, and the beginning of the first partition. So, that being the case, I issued the following command on my working MBWE:
dd if=/dev/sda of=/root/fullbootsect.sda bs=512 count=48194
This gave me a file of approximately 26 megabytes, and WILL contain ALL of the data (whatever it may be) between the beginning of the disk and the first partition. This will include the boot sector, the boot loader, and any other extra information that may be present there…
Needless to say, I did this on both drives, substituting sda with sdb… So, now my boot sector files equal about 52 megabytes total. A little larger than the 1kb that the other howto's use, but guaranteed to contain all the information needed.
dd if=/dev/sdb of=/root/fullbootsect.sdb bs=512 count=48194
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
Next is the issue that I see of partition tables. They differ depending on what sized drive you have. However, they only differ in the last partition. So, I thought, why do we need the data partition to restore the system? We, theoretically could restore the system on both drives, configure the redundancy, boot it, and manually create the data partition later, right? That would completely eliminate any possible problems of worrying about what sized drive you have…
So, my ptable files are as follows:
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start= 48195, size= 5879790, Id=fd
/dev/sda2 : start= 5927985, size= 208845, Id=fd
/dev/sda3 : start= 6136830, size= 1975995, Id=fd
and
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 48195, size= 5879790, Id=fd
/dev/sdb2 : start= 5927985, size= 208845, Id=fd
/dev/sdb3 : start= 6136830, size= 1975995, Id=fd
note the lack of the 4th partitions. What this does is creates the system partitions only, and leaves the end of the disk empty, so we can create the data partitions whenever we're good and ready to… This makes streamlining the restore process easier, since you don't have to worry at all what sized data drives you're using. You'll just be telling it to use all of the remaining space when you do finally get around to making that partition…
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
And finally, the hardware I used to restore the system. I use a standard PC, with two CD-ROMs in it, and NO HARD DRIVES! I can't tell you how many people I've talked with over PM or seen in the forums that screwed up their whole system because they were confused about what drives were in the system. Keep it SIMPLE! Remove all hard drives from the system except for the two drives from your MBWE2. You have to open the machine already anyway to hook up the MBWE2 drives, why is it so difficult to grasp the concept of disconnecting all the other hard drives? This will stop you from doing something stupid!!! It's the same idea as "measure twice, cut once…" COMMON SENSE, folks…
Now, the reason I use a system with two CD-ROMs is because I use a live cd to do the restore. Yes, the machine that I use normally runs linux anyway, but to make sure that I NEVER screw up my main linux install, I remove the drive, and do the restore using a live CD. It eliminates oops's. So, the first CD has an Ubuntu Install CD (A Live CD), and the second contains a burned CD with the data files I will need to restore my MBWE2.
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
OK, now that I have that out of my system, I will post a copy of the file that I put together while I was restoring a bricked MBWE2 that another user on this forum sent me because he was unable to get it running himself, and had given up on it. I offered to see what I could do with it, fully expecting him to tell me to go pound sand, but surprisingly enough, he had a little faith and sent me his MBWE2. So while I was restoring his machine, I made notes of every command I used to restore his system. And here it is…
Once the Live CD was booted, I opened a terminal window.
# Change to the ROOT user and change the current directory to the MBWE2 Data Files CD directory
su
cd /media/xxxxxx
# Now I restore the boot sector and the boot loader
dd if=fullbootsect.sda of=/dev/sda bs=512 count=48194
dd if=fullbootsect.sdb of=/dev/sdb bs=512 count=48194
# Next recreate the system partitions
sfdisk /dev/sda <part.sda
sfdisk /dev/sdb <part.sdb
# Then restore the data to the system partitions
bzip2 -cd sda1_image.bz2 | dd of=/dev/sda1
bzip2 -cd sdb1_image.bz2 | dd of=/dev/sdb1
bzip2 -cd sda2_image.bz2 | dd of=/dev/sda2
bzip2 -cd sdb2_image.bz2 | dd of=/dev/sdb2
bzip2 -cd sda3_image.bz2 | dd of=/dev/sda3
bzip2 -cd sdb3_image.bz2 | dd of=/dev/sdb3
# The Live CD doesn't come with the RAID tools, so install them
apt-get install mdadm
# Now reassemble the system RAID partitions
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1
mdadm --assemble /dev/md2 /dev/sda2 /dev/sdb2
mdadm --assemble /dev/md3 /dev/sda3 /dev/sdb3
# We're going to mount the boot partition and go to the config directory
mkdir /media/md1
mount /dev/md1 /media/md1
cd /media/md1/etc
# Now edit the inetd.conf file to enable SSH logins
vi inetd.conf
##use arrows to move down to the line that starts with #ssh
once the cursor is on the # sign at that line, hit the "x" key to remove the #
Hit escape. Then type in ":wq" without the quotes.
This will drop you back to the command prompt. SSH is now permanently enabled.
# I disable mionet, since I don't use it, and it's a resource hog
mv init.d/mionet.sh init.d/mionet.sh.disabled
# Confirm that the UUIDs of the system partitions are correct.
mdadm -Es
This will output 3 lines of what looks like gibberish. Note the characters after UUID=
cat mdadm.conf
compare the UUIDs of md1, md2, and md3. Ignore md4 for the moment.
if they match, then that's good. if they don't (they should, but check anyway), then use
vi to edit the mdadm.conf file and change the UUIDs in that file to match the output from
the first command in this section (mdadm -Es)
# Now we're going to copy the .tar.gz file to a location on the system in case we need it later
# I don't expect to need it, but good to have it just in case...
cp /media/xxxxx/SDA4FILES.TAR.GZ /media/md1/root
# We're done for now. Unmount all the filesystems and shut down the PC.
cd /
umount /dev/md1
/sbin/poweroff
# -----------------------------------------------------------------------
# Pause and take a breath...
# -----------------------------------------------------------------------
# Remove drives from PC and reinstall into the MBWE2 box. Turn it on.
# NOTE: System should boot, but will give inner-ring outer-ring failure. This is expected!
# This is because the data partition isn't created yet. System should be fine otherwise.
# After about a minute or so from when you power on the MBWE2, open a browser on any PC on the
# network and go to:
# http://mybookworld
# Setup regular user account
Click the "File Sharing" tab
When it asks you for username/password, use "admin" and "123456"
Click "User Management"
Click "Create User"
Follow the steps to create a regular user
# Now we login via SSH to the box. You can use your favorite SSH client for this. I personally use PuTTY.
# Login using your "regular user" account you created above. username/password all lowercase!
# Change to root. The root password should be "root" (without the quotes)
su
# use FDisk to create your data partitions. This works on ANY SIZED drive!!
fdisk /dev/sda
"u" to change to sectors instead of cylinders
"n" to create a new partition
"p" to make a primary partition
"8112825" for the starting sector
Use the default for the last sector
"t" to change the partition type
"4" to change partition 4
"fd" to change it to a Linux RAID Autodetect
"w" to write the changes to disk
fdisk /dev/sdb
Do the same steps exactly as done above with /dev/sda
# IMPORTANT! Now you have to reboot! When it comes back up, re-login via SSH, and change to root...
/sbin/reboot
# Create the data partition and format it (yes, this creates Raid-1. You can change it later!)
# NOTE: This didn't work for me when I tried to make a RAID-0 this way. So I do it Raid-1...
mdadm -Cv /dev/md4 -l1 -n2 -c64 /dev/sda4 /dev/sdb4
mkfs.ext3 /dev/md4
# And Mount it. As soon as you mount it, the inner-ring outer-ring problem should stop immediately
mount /dev/md4
# Change to the configuration directory
cd /etc
# Confirm that the UUID of the DATA partition is correct.
mdadm -Es
This will output 4 lines of what looks like gibberish. Note the characters after UUID=
cat mdadm.conf
compare the UUIDs of md4.
if they match, then that's good. if they don't (these PROBABLY DON'T!!), then use
vi to edit the mdadm.conf file and change the UUIDs in that file to match the output from
the first command in this section (mdadm -Es)
# If you plan on using one large drive instead of mirrored drives, now would be the time to change it
#
# To do so, go back to http://mybookworld
Click the "Drive Management" tab
Click "Change Drive Type"
Follow the instructions to change it to "linear" This will take 15-20 mins.
Once it says "Format Complete", restart the MBWE2
From ssh, type in "/sbin/reboot"
Or you can push-and-hold the front button on the MBWE2 until the outer ring starts to spin
# -----------------------------------------------------------------------
# That's it! You're DONE!! You've now got an MBWE2 restored, with the drive configured the way you
# want it. Mionet's disabled, and SSH login is enabled.
# -----------------------------------------------------------------------
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
Now, once it was up and running, that was when I noticed that the MAC address of the now-unbricked MBWE2 matched the MAC address of my MBWE2. Curious, I looked into it, and found that the MAC address is one of those things that is stored in the "empty" space between the beginning of the disk and the first partition, so, to fix it, I put together a quick script that will change the mac address to the proper one on every boot… NOTE: You will not have to do this if you have made a boot sector from your own MBWE2 beforehand! You will only need to do this if you're using the boot sector from another MBWE2….
vi /root/macaddr.sh
Once it's up, hit the letter "i" for insert and enter in the following 3 lines
ip link set eth0 down
ifconfig eth0 hw ether 00:90:A9:XX:XX:XX
ip link set eth0 up
Then hit Escape, then type in :wq (to write the file and quit out of vi)
chmod 755 /root/macaddr.sh
ln -s /root/macaddr.sh /etc/init.d/S11macaddr.sh
Obviously you will need to change the XX:XX:XX at the end of the MAC address above to match the one that's on the sticker on the back of your MBWE2…
And that's it. You should now have a completely restored, factory fresh MBWE2, with SSH enabled the proper way, and MioNet disabled, and having the proper MAC address… As I said, I wrote this as I was restoring a dead MBWE2, with blank drives, so I know this works. And the good part is that this will work with any sized drives!!! No need for any specific files for differing sized drives…
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
Now, for the summary of the files that I have on my MBWE2 Restore CD, and where they came from:
fullbootsect.sda and fullbootsect.sdb -- Approx 26MB each -- I made from my own MBWE2
part.sda and part.sdb -- 202 bytes each -- These are the files whose contents I listed out at the beginning of this message
sda1-3_image.bz2 and sdb1-3_image.bz2 -- all 6 files together = about 126MB - from christoff4444's images
SDA4FILES.TAR.gz -- 219 bytes -- also from christoff4444's images (though I don't actually use this file in my restore)
That's it. 11 files and my step-by-step is all I need on my Restore CD.
0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
One other thing of note. I've read somewhere that the SMART monitoring on the MBWE2 looks for specific answers from the drives, and one of the things it looks for is something that only WD drives give out. I don't remember what it was, but if you're planning on using non-western-digital drives in your MBWE2, you might want to look into this. There is a fix, but it looked like a huge hassle. It'd probably be much easier just to use WD drives…
I know this is a little different than the other HOWTOs, but this is the way that felt most comfortable for me. If nothing else, those who are comfortable in linux can decipher what I did when, and why, and maybe use that knowledge to make their own way…
Either way, I hope this helps…
-ET
Edit: Bootloader Findings:
Going through my 26 Megabyte boot loader files, it appears that only the first 5.5 Megabytes of that space is used for actual data. Specifically, the first 5,527,115 bytes. So, theoretically, you could create your boot loader files using the following command:
dd if=/dev/sda of=/root/fullbootloader.sda bs=512 count=10796
and
dd if=/dev/sdb of=/root/fullbootloader.sdb bs=512 count=10796
Then, when putting your boot areas on the new drive, you could do it with the following commands:
dd if=/dev/zero of=/dev/sda bs=512 count=48194
dd if=fullbootloader.sda of=/dev/sda bs=512 count=10796
and
dd if=/dev/zero of=/dev/sdb bs=512 count=48194
dd if=fullbootloader.sdb of=/dev/sdb bs=512 count=10796
This would ensure that the drive is zeroed out through the entire area between the beginning of the disk and where the first partition starts, then restores only the data portions of that area, keeping the boot loader files smaller (5MB rather than the 26MB each that my original files were)…
Edit: Further/Final Bootloader Findings:
As you will probably see if you scroll down to the end of this topic, a proper solution has been found for fixing the mac address in the bootloader… I have tested this system, and it works on all of the mac addresses I have the ability to test with. So I'm confident it will work with all mac addresses.
I will be creating another topic in this forum titled "MAC Addresses - Bootloader - Checksums". Search for it. It will give a brief overview of what was found in this thread, and will include a list of MAC addresses, and their corresponding checksums. This will provide a list of known working checksums you can use. If you would like your MAC's checksum (if you've lost it), post there, and I will post the checksum bytes for it in reply…




















