LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-08-2007, 01:51 PM   #1
neoAKiRAz
Member
 
Registered: Jan 2006
Location: Uruguay
Distribution: Kubuntu
Posts: 48

Rep: Reputation: 15
Moving Linux Partition to Another Disk


Hi, I need more help I have a Dual Boot XP/Kubuntu system with Grub in the MBR. I'm planning to get rid of my XP partition and stick to Linux, using VMWare for the XP applications I need to use. I have two SATA disks, with the following partitioning:

sda1 - XP Boot Partition (NTFS)
sda5 - Data (NTFS)
sda6 - XP Swap (NTFS)

sdb1 - Data (NTFS)
sdb5 - Linux Boot Partition (EXT3)
sdb6 - Linux Swap
sdb7 - Data (NTFS)

I want to replace the XP Boot partition with the installed Linux in sdb5, and the XP Swap with the Linux Swap, and maybe doing some resizing. Is there any way I can do this without reinstalling Kubuntu?
I know how to use Partimage to backup my Kubuntu partition, and how to restore it, so maybe I could try reformatting sda1 to EXT3 and restoring from the backed up image, but (even if I managed to properly configure Grub) I'm not sure there's even a chance that the new copy would boot up. Any advice on how to do this?
Thanks!
 
Old 04-09-2007, 04:28 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Bruno Azzinnari
Is there any way I can do this without reinstalling Kubuntu?
Yeah, I think so. While you might be able to use partimage as you imagine, I would not think that the easiest way. (Although if you care about the data, backing up is never a bad idea.) If you just want to trash what is currently on /dev/sda, I would just suggest using your favorite partitioning tool to set up the the partitions for Linux as you want them, and then using mkswap and mkfs.ext3 to create your swap and filesystem. Or you could do all of this with your choice of parted/gparted/qtparted. If you want to save the contents of /dev/sda5, just use one of the previous tools to set things up as you like, with the apropriate partitions configured as EXT3 and linux-swap.

Then, instead of retoring from partimage, I would just copy the files over:

rsync -a --ignore-existing /mnt/sdb5/ /mnt/sda1

where /dev/sdb5 and /dev/sda1 are already mounted on /mnt/sdb5 and /mnt/sda1 respectively. You will probably have to create these mount points with mkdir. You can create/use other mount points if you wish. I am assuming you are copying into an newly created EXT3 file system that should have nothing but the lost+found directory. The --ignore-existing switch is so that that directory does not get copied. (The trailing slash on /mnt/sdb5/ above is required, or else it will do something different.)



Quote:
I'm not sure there's even a chance that the new copy would boot up.
I'm pretty sure it won't boot up until you reinstall GRUB. You can do that by using your installation CD as a live CD. Although I've used the grub command a few times, I still don't have great confidence in what I am doing, but I believe the following is correct.

After you boot the CD, get a terminal window, type sudo grub, and then enter the following. I am including grub's prompt -- what you enter is in red.

Code:
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
EDIT: BTW, when you restore a partition with partimage, it is not necessary to first put a filesystem on it (format it). Since partimage replaces all used sectors anyway, whatever you just put there gets wiped out. And the file system is part of what partimage replaces.

Last edited by blackhole54; 04-09-2007 at 04:38 AM.
 
Old 04-09-2007, 04:45 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Setup the partition in advance and (from a liveCD say) use "cp -a ..." to copy the partition over.
Then fix grub at the same time.
Do it all the time - easy.

For the swap, simply do a mkswap/swapon.
Fix up fstab, and you're done.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Linux Installation from One Partition to another? jsstevenson Linux - General 1 07-20-2006 11:05 AM
moving unallocated disk space into reiserfs partition. GUIPenguin Linux - General 3 04-08-2006 03:07 PM
moving files from windows partition to linux partition M O L8ingN2dust Linux - Newbie 11 01-08-2006 09:11 PM
Moving linux partition short101 Debian 4 10-14-2004 06:06 AM
Moving Disk Space in Linux ALF Linux - Software 6 11-27-2003 06:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration