[Discuss] transferring a Ubuntu installation

John Blomfield jabfield at shaw.ca
Thu Oct 1 09:35:37 PDT 2009


SJF wrote:
> Thanks all for your input.
> It looks like a fresh install is the best route for me. For my level 
> of knowledge I can see that there is too much opportunity for me to 
> get in trouble for me to attempt a holus-bolus transfer. Thanks again.
> Stan Fisher
Just one correction in my last email.  The MBR is of course on sda not sda1.

If you do proceed with a new install and transfer your /home/sjf 
directory data on sdb1 to sdb7 be careful not to transfer any hidden 
configuration directory files e.g /home/sjf/.directory/ and 
/home/sjf/.files as these may screw up your new installation.  To use 
rsync to make the transfer I use the following:

from your new installation create a directory /mnt/oldpart by mkdir or 
with nautilus, as root.

sudo mount -t ext3 /dev/sdb1 /mnt/oldpart

sudo rsync -avz --perms --exclude=.* --exclude=.*/*** /mnt/oldpart/   
/home/sjf/

(don't forget the "dot" in --exclude=(dot)* and --exclude=(dot)*/***)

These exclude options will exclude all those configuration files.  
However there may be some data that you want from the hidden 
configuration files, for example, from you email client and browser 
client.  I just transfer these one at a time afterwards to be safe.

I also use the above method to archive (backup) my home directory data 
and synchronize my home directory between my desktop and laptop 
computers (adding option -b to backup changed files).

If you are not comfortable with command line, you can use Nautilus 
(Ubuntu's file manager) to copy the various directories from /home/sjf 
but turn on the "show hidden files" first so that you can exclude them.  
Nautilus/Ubuntu will I think automatically mount your /dev/sdb1.

I am sure others will have alternative (maybe better ) methods but this 
works safely for me.

John Blomfield




>
> John Blomfield wrote:
>> Murray Strome wrote:
>>> SJF wrote:
>>>> I have Ubuntu installed on a partition that is too small (and which 
>>>> I can't expand), and I would like to transfer it in entirety to a 
>>>> larger partition on the same drive  (from sdb1 to sdb7).
>>>> What I have found is:
>>>>
>>>> cp -a /bin /boot /dev /etc /home /lib /lost+found /mnt /root /sbin 
>>>> /tmp usr /var /sdb7
>>>> I presume this is done in a terminal in sdb1 (my present Ubuntu)
>>>>
>>>> Anyone with experience with this or any obvious problems? Any 
>>>> suggestions welcome
>>>> Stan Fisher
>>> Whenever I do this kind of thing, I usually load a "Live CD" version 
>>> of LINUX (doesn't really matter which one) and work from it. You may 
>>> have to select some other options as well to save the permissions. 
>>> Also, I am not sure how the links will be handled without specifying 
>>> them.
>>>
>>> If you have a large enough external HD, you might be better off to 
>>> use dd to copy sdb1 it (so you have a complete backup). You could 
>>> then dd that to sdb7.
>>>
>>> The next problem you will have is getting it to boot from sdb7 
>>> instead of sdb1. If you just use cp, you will probably have to use 
>>> fdisk to make sdb7 bootable, and you will likely have to do some 
>>> fooling around with GRUB to get the boot to work.
>> Which ever method is used you will end up with a boot record that 
>> points to the wrong place.  I am assuming that you have Grub stage 1 
>> in the MBR of sda1 and that Grub Stage 1.5 or 2 and menu.lst is in 
>> sdb1:/boot/grub/, so the MBR in sda1 now has to point to 
>> sdb7:/boot/grub/.  To change this you need to run a Live CD OS and 
>> the run Grub root and setup commands.  In addition your /etc/fstab 
>> will need editing and Ubuntu uses UUID to identify its partitions 
>> instead of /dev/sdb7 etc. You can of course change this or you can 
>> find the appropriate UUID from
>>
>> $ sudo vol_id -u device
>>
>> . You may find other configuration issues come up with some 
>> applications that depend on the partition device sdb1 information 
>> although I can't think of any off hand.  There is therefore some 
>> merit in Murray's suggestion to install a new Ubuntu on sdb7 and just 
>> move your data from sdb1, and solve all the Grub problems.  An 
>> alternative to cp or dd would be rsync which allows you to preserve 
>> permissions and monitor progress but I would not presume to say which 
>> is the best approach.
>>>
>>> Personally, I would probably dd the sdb1 to somewhere other than 
>>> sdb7 and then do a new install to sdb7. You could then use a Live CD 
>>> (or possibly the new installation) to copy the various files from 
>>> your saved sdb1. You could later edit the menu.lst in /boot/grub to 
>>> eliminate the pointer to the image on sdb1.
>>>
>>> Murray
>>>
>>> I am sure someone will have a neater solution.
>>> _______________________________________________
>>> Discuss mailing list
>>> Discuss at vlug.org
>>> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>>>
>>
>> _______________________________________________
>> Discuss mailing list
>> Discuss at vlug.org
>> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>>
>>
>
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>



More information about the Discuss mailing list