Sucker for entertainment

There’s a few ways to do things.

The first is the right way, the second is the wrong way, and the third, is perhaps a combination of both in a more interesting combination.

When the right way doesn’t (or can’t) work, and the wrong way is not an option, you then need to figure out a way of making the right way work, or the wrong way right.

I’m such a sucker for this kind of entertainment at times.

I’ve just spent the better part of today reorganising a linux filesystem, and using virtual drives to get space, in a space poor environment, I came across an issue.

I need to move the entire OS off one drive, onto another, due to partition size constraints.

How do I best do this, when the virtual drive cannot be resized?

Well, my solution thus far has been to add a second drive, which is capable of large growth, and then, dd all the files, and swap out the old for the new.

I originally planned on just moving /, and that’d work, but, I’ll admit, I’m not as proficient in the setup part of linux, to move partitions like that.

Being the sucker for an entertaining scenario such as that though, I tried to do it anyway.

So, I added the additional drive. That worked fine. Mounted it. Worked fine. Partitioned it. Yep, that worked fine.

Executed:”dd if=/dev/hda2 of=/dev/hdb1″, being carbon copy all of the partition of /dev/hda2, to /dev/hdb1.

It finished successfully. Sweet I thought. I thought that out, guessed and got it right so far.

Now, we have the next problem. Switching the OS to the new root and booting from it.

So I figure, ok, I can just open /etc/fstab, and change LABEL=/, to /dev/hdb1, and point that as the / partition.

Apparently, the kernel panic afterwards says no.

So, I go back to the ISO, boot into rescue, and change back to the old line, reboot, still no joy.

Hmm k, now we have a problem. So, I resolved it temporarily by removing the second virtual drive from the system.

Now, I must figure out a solution. At a guess, it’s still finding /dev/hda2, and sees it labelled as / and is doing some kinky stuff with it.

I probably need to find a way to Label /dev/hdb1 as “/”, so LABEL=/ works, then, find a non-destructive way of hiding /dev/hda2, so that we can go forward in the other much larger task.

Or, maybe it is more wise, to instead, dd /dev/hda /dev/hdb, thus replicating the full system.

I did have a concern about hitting /dev/random, and /dev/null, but figure, perhaps it won’t hit those and we won’t have a problem (and we didn’t).

Task for tomorrow will be to figure out how to do this copy successfully, otherwise, it’s off to find some DOS based clone software and use that to do the job.

Though, I should learn how to do it with dd, can’t be that difficult!

Enjoy!

This entry was posted in Linux, Programming, Random. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *