LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-17-2007, 01:38 PM   #1
brjoon1021
Member
 
Registered: Dec 2003
Posts: 152

Rep: Reputation: 16
Can a Linux OS be copied or moved from one partition to another ?


Hi,

I would like to move a couple of working Linuxes, namely Mandriva and OpenSUSE to partitions other than the the ones that they reside on now. Mandriva and SUSE have all parts (/home,/var ,etc...) of the OS within the partitions in which they are now installed except that the swap is on another partion of another disk for speed.

1. I would like to know if I can move or copy the OS to an existing partition on a different hard drive without destroying the OS. Also, how to do it, if it can be done...

2. The disks are partitioned on this computer. My purpose is to move all of the /mnt partitions for the Linuxes to one disk and all of the /home to another disk and shared swap to a third disk so that I can open up the last disk just for storage as a FAT32 for Windows and Linuxes.

Once I have moved the Mandriva, Suse and possible other Linuxes, I will want to make several smaller partitions out of three larger ones that I have now.
- a. Can I delete partitions AFTER the last partition on a disk that has an OS on it without wrecking the OS's on the first partitions of the disk ? For example, let's say I have Mandriva and Suse on hda1 and hda2, and hda3, 4, 5, 6 are vacant ext3 partitions. I would like to make 9 smaller ext3 partitons out these larger ones. I am concerned about whether that will have an effect on the OS's on the first two partitions. I don't think that this will mess up SUSE and Mandriva. Do you know ?


Thanks,

B.
 
Old 07-17-2007, 02:34 PM   #2
slackbat
Member
 
Registered: Dec 2005
Location: uk Lampeter
Distribution: Slackware 14_64_multilib - Manjaro and Debian/Siduction
Posts: 59

Rep: Reputation: 17
Hi brjoon1021

Quote:
1. I would like to know if I can move or copy the OS to an existing partition on a different hard drive without destroying the OS. Also, how to do it, if it can be done...
Yes. Once moved you need to alter /etc/fstab and /etc/mtab to reflect the different partition numbers. I tend to use partimage to backup the partitions to a spare partition before placing onto the new partitions - again using partimage for this. You will probably need a live cd such as knoppix to alter fstab and mtab to reflect the difference. cfdisk is good for creating the partitons.

Quote:
I am concerned about whether that will have an effect on the OS's on the first two partitions. I don't think that this will mess up SUSE and Mandriva. Do you know ?
If those last partitions you mention are indeed vacant and unused, there should be no problem. But it might be an idea to edit /etc/fstab - if the partitions are listed at all - and remove/comment their entries.

Good luck
 
Old 07-17-2007, 02:35 PM   #3
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
The answer is yes but probably not the way you have in mind.

General steps are, say you have a Linux in sda7 and want to move it to sdc2

Boot up a Linux not related to the one you want to migrate, in terminal

Code:
mke2fs /dev/sdc2
mkdir /mnt/sdc2
mount /dev/sdc2 /mnt/sdc2
mount /dev/sda7 /mnt/sda7
cd /mnt/sda7
tar cf - . | (cd /mnt/sdc2; tar xf -)
go into /mnt/sdc2 and change
(1) boot loader reference from sda7 to sdc2
(2) /etc/fstab same alteration
(3) Restore the boot loader (only if you boot by chainloading)

All Linux should use a common swap.

/mnt cannot be shared.

Sharing a /home between Linux may upset the desktop setting.

Yes you can move Linux around. I do it all the time.
 
Old 07-17-2007, 02:38 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,152

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
BTW the mtab file is automatically updated by the mount command, one should never need to manually edit this file.

Last edited by michaelk; 07-17-2007 at 02:50 PM.
 
Old 07-17-2007, 03:18 PM   #5
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
I did such a thing recently. This CD was a big help:
http://www.sysresccd.org/

Yves.
 
Old 07-17-2007, 03:21 PM   #6
ComputerBob
LQ Newbie
 
Registered: Jun 2007
Location: The Beautiful Sunshine State
Distribution: Debian Squeeze
Posts: 28

Rep: Reputation: 15
Quote:
Originally Posted by michaelk
BTW the mtab file is automatically updated by the mount command, one should never need to manually edit this file.
Whew! That's a relief! As I read through this thread, I thought to myself, "Uh-oh -- I've edited /etc/fstab many times in the past year, but I've never even looked at /etc/mtab."

When I read your post, I finally realized why that is.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I think I copied a file over my entire Windows partition transparent9 Linux - Newbie 40 05-24-2007 09:18 AM
A copied file != a moved file Caesar Tjalbo Linux - Newbie 4 11-09-2006 08:05 AM
Reinstalling GRUB on a copied partition Exasperated Linux - General 3 02-05-2005 06:02 PM
Windows files copied to my linux partition are locked when logged in as a normal user necbrownie Slackware 8 10-15-2004 09:11 AM
WinXP can't read linux files copied to FAT32 partition gdh Linux - General 1 08-07-2004 11:31 AM


All times are GMT -5. The time now is 08:46 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration