Help with 'from outside copy' on clean installation of Debian

I’m tying to make a clean installation of Debian on my MyBook Live using this guide -
http://www.schwabenlan.de/en/blog/2015/04/06/clean-debian-install-on-mybook-live-nas

Everything has gone fine, right up until the final step, which states -

From outside copy

Gondor:/boot# cp /boot/apollo3g.dtb /newsys/boot/

And I am not sure what it means by ‘from outside’. If I have my head around it right, I think it means from outside the partition (as in copy the apollo3g.dtb file from the boot folder on the old partition to the boot folder on the new partition), but I don’t know how to do this.

Any help?

EDIT - Don’t read any of the replies below, most of them are irrelevant, going round in circles. After contacting the author of the guide he explained that by ‘from outside’ he simply meant outside of chroot, so all I had to do was exit chroot before doing the last step. Somehow I overlooked that, but the guide has now been updated to mention it so that it’s slightly more newbie proof for people like me!

I was going to follow that guide until I realized there are too many steps not explicitly explained or detailed.

As a hardware/software engineer with a BSEE degree and a dozen years designing websites in my retirement, and running Debian dedicated servers, I decided the guide was not a sure thing. I’ve done years of tech writing, and the important thing is LEAVE NOTHING OUT including the stuff you know but sort of glossed over or forgot to mention I mean, everybody knows that, right?

It’s difficult to write a procedure and then read it and see what parts you left out because as an expert you have a blind spot,

And anyway, what’s this part about dividing up the DUO and leaving WD’s stuff on the other HDD. That’s not what I call a clean install. I want EVERYTHING written by WD gone, or as much as possible as a second choice.

I did feel that there were some parts missed out or not explained in enough detail - but I’m relatively new to Linux so I thought that was just me, and there were a couple of parts where I got stuck but I did have my head around what I was doing enough to work out what was wrong (like there’s a bit where you need to change working directory and I didn’t do that because it didn’t say to do so but it was obvious what was wrong, and there’s also a package that won’t install because it’s no longer there but it suggested a new package that replaces it, so hopefully that hasn’t affected anything adversely).

And I think the way he’s done it with keeping the WD partition is to have a backup in case things go wrong - he says you can restore the original system by adding sda1 to the RAID and resyncing. I guess if you wanted to get rid of all WD stuff you could do it the other way around - add sda0 to the RAID and sync - as a final step after making sure the fresh installation boots properly. But yeah, he doesn’t mention that as a possibility.

Do you know how I could do the last step? If I’m right, I could do it by putting the hard drive in my PC and manually copy the last file over, but it would much easier if I could do it via SSH.

Or, do you know of any other (semi-newbie friendly) guides for doing a fresh install of Debian or anything else? The reason I’m doing this is so that I can use a few programs, such as SickRage, on the MyBook that won’t run on the WD distribution because of outdated things like openssl 0.9.7 (when SickRage requires 1.0.1).

There are a few things you have left unclear. Do you have a DUO??? You posted in the MBL section not the MBL DUO section.

Yes I guess you are right, you could probably copy the modified partition to the other drive. But it’s set up to boot from the drive you modified. What if that drive goes bad? How’s it going to decide to boot from the other HDD? You can assume it will figure it out itself, but I find whenever I make assumptions they turn out wrong at the worst possible time.Okay maybe if the original modified drive goes bad you can just pull it and put the good drive in its place. But as an engineer I HATE the word ‘maybe.’

Another problem I have with that guide is that he shows some partitions as RAID and some not. ALL my partitions are marked RAID. Will that make a difference? I don’t know. Maybe. Maybe not. There’s that word I hate again.

Oh BTW if you install parted (version of Gpartd?) then yeah, I think you can copy the partition from the modified drive to the unmodified drive, using SSH. Wow, will that be fun rebooting it!!! :frowning: Will you get a green or blue light, or a white light? If a white light, what next? AFAIK there is NO de-bricking script that is guaranteed to work every time all the time.

BTW I just spent a whole week working on my MBL DUO and Googling all this, and I couldn’t find any better guide to get rid of the WD software and replace it with a pure Debian distro. Either Wheezy or the next, one forgot it’s name. I’ve even posted here to ask if anybody is willing to work with me to come up with a guide that removes every last bit of WD software and replaces it with a clean Debian distribution. I want just a NAS, nothing but a NAS. If anybody has written that I haven’t found it yet.


BTW just as an afterthought, the MBL does have a custom hardware design, so you will need their firmware. You can think of that as flashing your BIOS. It’s completely reasonable to keep that as long as it boots up into a partition with your OS and turns execution over to the OS. That’s when you want your Wheezy to take over and run software and packages you install yourself. There won’t be any control panel unless you install one of the various control panel packages, and you’re going to have to figure out how to turn your two HDDs into RAID. I haven’t done that last part yet but I’ve been managing Debian servers the last two years, no access except SSH and whatever you install. Like I’m on the West Coast and one server is in Netherlands. Obviously no chance for anything but SSH. My only on-site help is if I screw it up completely I can email the hosting company and have them re-image my OS, and start out fresh. (It’s good if you have your OS on a SSD and your data and sites on an HDD. Then at least all you have to do is rebuild your OS and packages.

So I hope this helps, it’s a little bit of information, some rambling, some speculation, and there’s an infinitesimal chance it might help you.

Meanwhile I have a MBL DUO that is half down except I have SSH access, and I’m currently moving all my data to another MBL DUO before I try anything with the one with the configuration problem. Even using scp it takes a lot of time to move 3+ TB of data…

It’s a MyBook Live 3tb, not a Duo (or I would have posted in the Duo section).

And he doesn’t show all partitions as RAID - the way the drive is originally set up, which he shows at the beginning of the guide, the first partition is 513mb swap space, then there are two 2gb partitions which contain the OS in RAID1 (so presumably if one partition fails it would just automatically boot from the other one), then the rest of the space on the drive is the storage.

Then the installation involves breaking the RAID1 and installing Debian on the first 2gb partition. The WD distribution is still safe on the second 2gb partition at the moment, so worst case scenario I can just copy it back over to the partition I’m currently creating the new installation on and restore it to how I had it. But if/when the new installation ever does work I can copy that over to the second partition and recreate the RAID1 and then presumably it would automatically boot from the second partition if anything went wrong with the first. This last step simply requires me to copy this apollo3g.dtb file (which I actually think is to do with the custom firmware as that seems to be the name of the board used in these MyBooks) from the WD partition to my new installation - I just don’t know how to access it ‘from outside’ or whatever that means.

If one partition fails the other one will boot? And you know this how?

BTW my guess is apollo3g.dtb is actually the motherboard BIOS.

You’re following a guide written for a MBL DUO and using a DUO drive in a plain 1 drive MBL? Good luck with that!

If it works, go out and buy 100 lottery tickets immediately! … Or would success mean you used up all your good luck?

I’m really annoyed. I am just soooooo close to being able to do a fresh Debian install on a MBL I can almost taste it. I have about half the pieces in place, but need them all for it to work without bricking.

By the way you should get a tool called “parted” that reads GPT partitions. GPT is necessary because of the huge (1TB & up) HDDs. That’s the main obstacle in many tools working. I forgot how I got parted but I think I added a repository that had it.

By the way DO NOT EVER type in this: apt-get upgrade

On a pure Debian system that’s a very good thing to do. On an MBL that command is also known as the “bricking command.” :wink:

That’s why I want just a Debian with no WD except the BIOS. I have about 2 years experience in managing Debian dedicated servers, and I want to be able to treat my MBL just like another server.

I’ll be following this topic and if you discover anything or need help just post and I’ll come look at it.

And whatever you do, DO NOT CLIMB INSIDE YOUR MBL!!! :wink: :wink: :wink:

Oh, just a bit more info. I have a few MBL DUOs and the partitions are identical on both HDDs. Maybe this will give you some info. I used parted to get this data.

[quote]Number Start End Size File system Name Flags

3 15.7MB 528MB 513MB linux-swap(v1) primary raid
1 528MB 2576MB 2048MB ext3 primary raid
2 2576MB 4624MB 2048MB ext3 primary raid
4 4624MB 4001GB 3996GB ext4 primary raid[/quote]

I think it’s speculation what partitions 1 and 2 are doing unless you have some source for your info that you would care to share. It is likely partition 1 is the boot, but it’s just an assumption that partition 2 is a copy unless you have an authority to back that up.

Okay, firstly, it’s not speculation or an assumption that partition 2 is a backup of partition 1 - they are in RAID1 together and that is what RAID1 is/does - it’s an automatic backup/mirror. As there’s only one physical drive, this backup isn’t going to help if there’s a mechanical failure (as it would in the Duo) but it does mean that if the file system on one partition became corrupt you’d have a backup to resort to. I’m not saying that the MyBook would know to automatically boot from the second partition if the first one was corrupt, but at least you would be able to manually copy everything over from the second partition to the first, either manually or by resyncing the RAID. So I can mess this new installation up as much as possible and it would only take me minutes to restore everything to how it was before I started this process - that’s why the first steps of the guide get you to unlink the RAID1 partitions, so that this fresh installation is not automatically mirrored on the second partition and you have that backup. But obviously I’d like to get past this final step and see if it works before I have to do that!

Secondly, why on earth do you think I’m following a guide for a Duo? Where does it say Duo in the guide I linked to? It just says MyBook Live, which is what I’ve got, so I’m following a guide for a MyBook Live and I’m asking for help in the MyBook Live section of this forum. So I’m not sure why you thought it was unclear which one I had, unless you think I posted in the wrong section, although I did state ‘MyBook Live’ in my first post and I would have stipulated if it was a Duo (and put it in the correct section). I did use parted - as the guide says at the beginning - and I wouldn’t have proceeded if my partitions didn’t match the layout shown. From what you posted, it does look like your Duo has the same layout as the single drive MBL, except all of your partitions are in RAID because they’re all mirrored on the second physical drive. This could mean that you’ve got four copies of the boot/installation partition - two on each physical drive - although your parted output doesn’t say what type of RAID each partition is in so it could be slightly different. I’m not sure how relevant this guide would be to the Duo in that case.

I’ve tried contacting the author of the guide via e-mail but it bounced so I’ve sent him a tweet. Hopefully he can explain the last step but if I can’t figure it out I’ll just restore from the other partition and then consider buying a MyCloud, which will do what I want out of the box.

RAID means both drives have identical information. Both my drives have identical systems (Debian). If one drive fails the other one has everything it needs to boot.

I don’t see how you can just assume the boot partition is copied. Please state an authoritative source for that.

Have fun! Please update with your success, failure, findings or requests for help.

I know what RAID is - I just described it to you as well. I have a RAID0+1 in my desktop PC so I’m very familiar with how different RAID setups work. If you know how it works then it should be obvious from the partition layout of the MyBook that the boot partition is backed up. Look again -

Number  Start   End     Size    File system     Name     Flags
 3      15.7MB  528MB   513MB   linux-swap(v1)  primary
 1      528MB   2576MB  2048MB  ext3            primary  raid
 2      2576MB  4624MB  2048MB  ext3            primary  raid
 4      4624MB  3001GB  2996GB  ext4            primary

Partitions 1 and 2 are the same size and they are both in RAID. When you use proc it tells you that it is RAID1 -

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[1] sda1[0]
      1999808 blocks [2/2] [UU]

RAID1 is a mirror array - i.e. partition 1 and partition 2 are identical. Any changes made to partition 1 are automatically applied to partition 2 as well. This is the whole purpose of RAID1. So it is clear from this that on a single drive MyBook Live the boot partition is mirrored so that it is backed up. On a Duo, both physical drives are mirrored to also backup the user data - presumably this backs up the boot partition three times as your partition layout also shows 2x 2gb partitions on the first drive, which will both be mirrored on the second drive.

So it is obvious to me simply from the partition information, but if you need other sources then just re-read the guide I linked to. Right at the top, under ‘Overview’, he says ‘The system partition is a raid 1 such that upgrades can be rolled back. We will use one of the two RAID 1 partitions for our new system in this guide.’ Then later he says ‘RECOVERY: In case that something went wrong and you need to restore the original system, add sda1 to the raid and resync.’, which is essentially copying partition 2 back over to partition 1.

Another source is the guide that this guide was based on, which is here - http://blog.loetzimmer.de/2014/10/debian-wheezy-auf-wd-mybook-live-mbl.html
It’s in German but Google does a pretty good job of translating it. In the second paragraph he says ‘The MBL uses a clever approach to update Error Prevention. The two partitions / dev / sda1 and / dev / sda2 form a RAID1 (mirror). In update case, an image is copied directly to one of the two partitions, and after successful completion (checksum test agrees) the other plate in the raid will be marked as “dirty” and so after a restart with the now geupdateten system overwritten (Raid Rebuild). This circumstance also allows safely perform the procedure described here (Wheezy on / dev / sda1 install) and if it does not like, could return about the raid rebuild again been spilled WD Image. A serial interface is not required, however, one should be able to remove the hard disk from the housing and mount into a Linux computer, the / dev / sda1 to empty and possibly the Raid from / dev / sda2 restore. understanding the boot process took away my fear, to make in my attempts something irreparably broken.’ So he’s basically saying don’t worry if you mess up a fresh installation - you can restore your current one from the RAID backup, you just need to remove the first partition from the RAID first so that your changes aren’t mirrored to the second partition.

I think I’ve explained this clearly three times now, and now I’ve provided sources and I’m sure other people on this forum could verify this, so please stop saying I’m making assumptions.

And if you have any suggestions for my actual request for help, about copying a file from one partition to another, then please let me know, because this has otherwise gone way off topic.

Yes, I can do that. In fact I just did it 10 minutes ago. Without reading the entire topic, pardon me if I might repeat some of the above. And as far as your getting mad, note that printed communications on forums is flawed and there are often misunderstandings, sometimes even leading to flames, so don’t get mad at me. I’m just trying to help you.

Now here is what I did. I have a Debian Wheezy desktop. Unfortunately it was not partitioned with GPT capable boot so I can’t mount a GPT partition. BUT. The two partitions we are discussing are ext3, and it’s no problem to mount them. Here is what I did. (Note that you know some or all of this but I am writing to the larger audience of the entire forum so that others may benefit,)

  1. Connect your MBL drive to your desktop, I put it on the second IDE as master, with no other drives You may need to adjust this procedure if you connect it differently. My Wheezy is an old 386 and I’m using a SATA adapter.

  2. Run this command: gdisk -l /dev/sdb

output:[quote]GPT fdisk (gdisk) version 0.8.5

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 7814037168 sectors, 3.6 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2624C162-2AD1-4796-A0BC-6509C055833C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 2048-sector boundaries
Total free space is 32365 sectors (15.8 MiB)

Number Start (sector) End (sector) Size Code Name
1 1032192 5031935 1.9 GiB FD00 primary
2 5031936 9031679 1.9 GiB FD00 primary
3 30720 1032191 489.0 MiB FD00 primary
4 9031680 7814035455 3.6 TiB FD00 primary[/quote]

We know 4 is the GPT partition with your data because of the 3.6 TiB size. (I have the 4TB model.) My guess, 3 is used for swap.

  1. Now let’s mount partitions 1 and 2. It is a Linux tradition to place your mount points in a directory /mnt. We will create two mount points, make them writable, and mount the first two partitions. Execute the following:

[quote]mkdir /mnt/sdb1
mkdir /mnt/sdb2
chmod 777 /mnt/sdb1
chmod 777 /mnt/sdb2
mount -t ext3 /dev/sdb1 /mnt/sdb1
mount -t ext3 /dev/sdb2 /mnt/sdb2[/quote]

Wheeeee!!! We’re in!

Now all you have to do is “cd /mnt/sdb1” and you are in partition 1. Or :“cd /mnt/sdb2” for the other partition. You have full read/write access and can copy or edit files or what ever you like.


My original problem is that I pooched this system by running “apt-get” upgrade. DON’T DO THAT!!! :smiley:

I had emptied the GPT partition (my shares) so that worst case I could just format this HDD and stick it in another MBL DUO (which is also empty) and rebuild. I may still do that, although it appears now maybe all I need to do is copy the boot partitions from the working MBL DUO and I should be good to go.

Here is a question I wish somebody could answer: In a MBL DUO, are the 2 boot partitions in drive A and the 2 partitions in drive B all identical? In other words, if I copy all files in partition 1 of the working MBL DUO either drive, can I then copy all those files into both partitions of both HDDs on my failed MBL DUO and expect it to work? Or are the boot partitions between drive A and drive B slightly differently configured?

It’s even easier considering that if I put the two new mounts in my fstab I can read/write any MBL DUO drive by powering down and swapping drives All are 4TB MBL DUO drives so my Debian workstation won’t know one from another. When I’m done playing with MBL drives I can just comment out my fstab, save the lines for future use.

So thanks to WD’s poor featured forum software I can’t read the back posts, but presuming you have a Linux desktop the steps above will give you complete access to partitions 1 and 2, and you can change or copy any data you want.

As for me, I think I’ll play around for a while since I have 5 MBLs and the remaining 3 have sufficient room for my immediate needs. I think I’ll give a shot at what you are trying to do, and if I succeed I will have the experience to answer any and all questions you may have.

I’m working with an even better safety net. If all else fails I can just remove the partitions from both HDDs, then stick one in the working empty MBL DUO, rebuild, put it back where it belongs and put the other unformatted drive in and rebuild again, and then all I have to do is ensure the two MBLs have different IP addresses and different network names.

Let me know if this helps. Now that I’m more up to speed, if this isn’t it then I’m in a better position to answer your other questions.

Just to add, you can copy a file “from the outside” using SSH. In this case you would use SCP which is a file transfer program that runs over SSH. There is also WinSCP if your file you want to copy is on a Windoze system.

If you are running a Linux box “on the outside” just use SCP. Or if a Windoze box use WinSCP. You can find WinSCP on the Internet, it’s a popular program.

Here’s the answer I was looking for -

exit

That’s right, I was only missing one short command, 4 letters. I got in touch with the author of the guide and he said that by ‘from outside’ he meant from outside of chroot. I don’t know how I overlooked that, but that’s all I had to do. The author has now updated the guide to make it clear - and he has also added another guide on how to update this clean installation of Debian to Debian Jessie.

In the meantime, I had switched my MyBook off, and because I hadn’t finished the installation it wouldn’t boot again. But it was very easy to restore it from the backup (that you thought I only ‘assumed’ I had) by connecting it to my desktop PC and copying the second partition over to the first, then rebooting. The command is simply -

dd if=/dev/sda2 of=/dev/sda1 bs=512 conv=noerror,sync

Where sda1 and sda2 are your first and second partitions, respectively. It takes a couple of minutes to copy the 2gb over but when it’s finished you can reboot the MBL and it boots up as if nothing happened!

Then you can add the first partition back into the RAID if you want, but I left it separate so that I could restart the guide, and get the last bit right this time!