How to move disk.root content in a full Ubuntu installation?

Asked by Michael Sioutis

I've been using wubi for a while, but I thought I'd go for a full istall of UBuntu, since I have experienced some grub related crashes.

I have backed up my root.disk, I can mount it and see all the files in it. How can I restore the entire root.disk content in a Ubuntu installation?
I want to do this in order to move my applications, software, settings etc from my wubi installation to my complete Ubuntu installation.

I tried by booting with a LiveCD and doing cp commands between the mounted root.disk and the filesystem, but that created chaos, since all permisions got messed up (well I was doing sudo cp).

Is there an other easier way? There has to be, but I don't know what to look for and I'd appreciate some pointers.

Thanx in advance!
Mike

Question information

Language:
English Edit question
Status:
Solved
For:
Wubi Edit question
Assignee:
No assignee Edit question
Solved by:
Michael Sioutis
Solved:
Last query:
Last reply:
Revision history for this message
Michael Sioutis (trelopedo) said :
#1

I found this guide here: http://ubuntuforums.org/showthread.php?t=35087

I guess I can backup the following into a giagantic tgz file:
bin
dev
etc
home
lib
opt
root
sbin
selinux
srv
tmp
usr
var

Then do a full install of ubuntu..

Then place the giagantic tgz file in the root folder..

And do: tar xvpfz [giagantic tgz file].tgz -C /

That is all?!

Mike

PS: I am talking about same machine/harware so binary files still work

Revision history for this message
bcbc (bcbc) said :
#2

It's easier to do it directly from the wubi install - I wrote a howto that has a script (modified from the original wubi-move-to-partition): http://ubuntuforums.org/showthread.php?t=1519354

But I wrote some instructions to do it manually from a live CD using just the root.disk for someone. They never tried it, but I did it successfully: http://ubuntuforums.org/showpost.php?p=9570445&postcount=12

Note: the above are for Wubi version 9.10 or later (original installed version) that are using grub2, not grub-legacy.

Revision history for this message
Michael Sioutis (trelopedo) said :
#3

That's a very nice guide!

Should I create the partiotions /dev/sda5 and /dev/sda6 you are reffering to, or is this done by the script?

Currenlty sudo fdisk -l lists:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7582f8fb

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 37629 302252032 7 HPFS/NTFS
/dev/sda2 37629 38913 10314752 7 HPFS/NTFS

(sda2 is a restore partiotion for windows).

So I could replace sda5 with sda3 and sda6 with sda4 in your script?

I will try it as soon as you answer :D

Mike

PS: grub is GNU GRUB 1.98-1ubuntu8, ubuntu is 10.04

Revision history for this message
bcbc (bcbc) said :
#4

You need to create the partitions yourself beforehand.

Yes - if you use the script you supply the partitions as parameters. But I thought you'd already removed wubi? The script has to run within the booted wubi install. Otherwise you need manual instructions.

Revision history for this message
Michael Sioutis (trelopedo) said :
#5

I still have a wubi of 30 GB.

So I will create 2 primary partitions sda3 and sda4, one for ubuntu installation and one for swap and I will run the script.
(by running the script, I mean following the manual instructions)

Will the wubi 30 gb space freed after this or do i have to uninstall it from windows?

Mike

Revision history for this message
bcbc (bcbc) said :
#6

You can do this - or you could create a single extended (primary) partition sda3, and then create logical partitions within that: sda5 and sda6. It doesn't make too much difference, but if you wanted an additional partition e.g. for data, then the extended gives you the ability to created more than 2 new ones (whereas you can only have a max 4 primary partitions).

The script will not free the 30GB. The wubi install remains unchanged (except the grub menu is updated to include the new migrated install). When you are satisfied the migration is successful, then you can uninstall wubi using Add/Remove programs. This will free up the space.

Revision history for this message
Michael Sioutis (trelopedo) said :
#7

Hi again bcbc,

you're method seemed actually cool, but you got beaten by Micro$oft. I tried to shrink my drive under Vista to create a new partition.It gave me only a partition of 7gb to create, when I had 80gb free space.
I deleted all possible system files, page files, dump files, disabled system restore, removed shadow copies, de-ragmented 3 times and for a totaling free space of 130gb it gave me a 15gb partition to create!!

My current file system in Ubuntu has a size of up to 12 gb, but I thought OK, I should at least create the 15 gb partition and try your method. (I'd prefer to have ubuntu in a 30-50gb space, I have it in 80gb space in my desktop with 3 gb swap - rules)
I click on "shrink" and a few seconds later "Error, no permission to access logical drive" or sth like that.

It is such a joke.

I thought of using a gparted LiveCD, boot from there and make my partitions and then try to repair Windows, but I think it is meaningless.
I'll probably install 10.04 on the entire disk and then extract the gigantic tar file I have created.

For now I locked version linux-image, grub-pc and grub-common in synaptic, so they are not updated :)

bcbc thank you very much for bearing with me and I am sorry I could not use your method which is very nice and straightforward.

Mike

Revision history for this message
bcbc (bcbc) said :
#8

That's unfortunate. I know some people use gparted when Windows refuses to cough up space, but you need to repair windows after that.

I can't vouch for these links, and recommend backing up if you do decide to use them...
http://www.howtogeek.com/howto/windows-vista/working-around-windows-vistas-shrink-volume-inadequacy-problems/
http://www.howtogeek.com/howto/windows-vista/using-gparted-to-resize-your-windows-vista-partition/

Revision history for this message
Michael Sioutis (trelopedo) said :
#9

Yes, it is because some unmovable objects exist at the end of the disk. Vista came with the laptop which I own for a year. I haven't used them for 2-3 months or so and I don't think they serve a purpose other than owning 300gb/320gb of space.

So to mark this thread closed:
1)Backup: tar -cvpzf /media/somedevice/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=backup.tgz --exclude=/mnt --exclude=/sys --exclude=/media --exclude=/host /
2)Full installation of Lucid
3)tar xvpfz backup.tgz -C /

Should I exclude anything else? dev perhaps? I see you alse exclude tmp in your script.

Mike!

Revision history for this message
bcbc (bcbc) said :
#10

I don't think you'll get a good result. If you overwrite the new install with the backed up lupin, you still have to remove lupin-support, update the fstab, etc. I've never tried to do it this way.

I'm not saying it can't work - but I've never heard of someone doing it this way.

Revision history for this message
Michael Sioutis (trelopedo) said :
#11

I don't think it will work too.. I think I'm stuck with wubi :D

I wish I could move my home folder and all my installed programms with settings to a clean install of ubuntu.

Mike

Revision history for this message
bcbc (bcbc) said :
#12

Well, your problem isn't moving Wubi it's creating a partition. The automated script I provided will migrate Wubi if you can create that partition.
If you can't do this on your main harddrive, you can still migrate the Wubi to an external drive. You can experiment/test as much as you like, since the migration doesn't change or damage the wubi install (it just updates the wubi grub menu).
You can also use the manual install commands that work from a live CD and just the backed up root.disk file. (Again, experimenting with an external drive makes sense if you are unsure).

Revision history for this message
bcbc (bcbc) said :
#13

Also look at the 'alternative instructions' on this link http://ubuntuforums.org/showthread.php?t=438591. It shows how to backup /home and get a list of all installed applications, that can be used to reinstall the same on a new install.

Revision history for this message
Michael Sioutis (trelopedo) said :
#14

Well bcbc, since you've provided me with 3 solutions I'll mark this one SOLVED.

For future reference, solutions are:
1)http://ubuntuforums.org/showthread.php?t=1519354 (u may have to use gparted to cut space from Window$)
2)http://ubuntuforums.org/showthread.php?t=438591
3)http://ubuntuforums.org/showthread.php?t=35087 (but u need to manually edit some files)

Mike