LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 01-25-2004, 11:42 PM   #1
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Rep: Reputation: 30
CLone/Copy a partition


My main root parition was only made with about 5 gigs, and it is filled up :O

Today, i deleted my old RH install off my second hard drive, SO i have a whole bunch of unpartitioned space.

Is there a way for me to move my / parition to my second drive, and thereby letting it grow in size?

I mean, Say i create a 10 gig ext3 partition on my second drive:
I need to
a) Copy all the data exactly from my 5 gig partition to the new 10 gig one
the
b) Set it up so the new parition is viewed as the / partition

How exactly should I do this?

THanks
 
Old 01-26-2004, 07:21 AM   #2
ugob
Member
 
Registered: Nov 2003
Distribution: RH, Fedora, Debian, Knoppix
Posts: 436

Rep: Reputation: 31
I think that:

It is your root partition? hmmm

To make it simple, grab a copy of Symantec Ghost or Powerquest drive image. Then make a disk-to-disk copy.

Or maybe try www.mondorescue.org

If you still want to try the hard way, I don't really know exactly how to do it.
 
Old 01-26-2004, 09:42 AM   #3
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
I don't see any problem, simply mount the new partition on, e.g., new, and launch as root a
Code:
cp -a /* /new
You'll get an error message at the end, but that's no problem.
Then you'll have to update 2 things BEFORE rebooting:
1. your lilo or grub conf file. In the first case,, remember to re-run lilo. In the latter, be sure to remove the old grub.conf or menu.lst on hda, or that will be used instead
2. your /etc/fstab of course
After rebooting you can get rid of old partition

Note that you can even safely move some branches, too. Say you want to move only /usr:
Code:
cp -a /usr /new/
rm -r /usr (this may cause problems if other tasks/users are running)
ln -s /new/usr /usr
or you can instruct /etc/fstab to mount hdb1 as /usr

Last edited by ac1980; 01-26-2004 at 09:43 AM.
 
Old 01-26-2004, 10:44 PM   #4
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Original Poster
Rep: Reputation: 30
Hm....i made a /new partition...a couple questions thought

Im looking at man cp

-a, --archive
Preserve as much as possible of the structure and
attributes of the original files in the copy (but
do not preserve directory structure). Equivalent
to -dpR.

WHat does that mean, does not preverse direcotry structure? Dont i need that?

Also,
What do you mean, I will get an error but that doesn't matter?

thanks
 
Old 01-27-2004, 12:10 AM   #5
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
I did this recently with Mandrake and Gentoo, I used the command cp -rp from a Gentoo bootable CD. I had no errors and no problems since. It copies all directories and keep the permissions the same.

That is my experience. What ever that is worth.

Later

 
Old 01-27-2004, 07:33 AM   #6
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Original Poster
Rep: Reputation: 30
So i made it start last night, before i went to bed

It ran ot of space, because it was trying to copy all info in /mnt
SO i deleted /new/mnt
And I'm going to try to copy the rest after.

I guess then I should create a /new/mnt and setup mout points...
 
Old 01-27-2004, 09:40 AM   #7
sb73542
Member
 
Registered: Jul 2003
Distribution: Ubuntu, SUSE
Posts: 79

Rep: Reputation: 15
In Windows 2000, you can define "volume mount points" which are "used to graft new volumes into the existing file system namespace without requiring the use of a drive letter." In other words, the same volume can reside on more than one physical partition or disk. I believe Linux can do the same with LVM. I have no idea how to use it, but the general concept is still the same- you wouldn't have to copy your partition over, just logically tack additional space onto it. Anyone know how exactly to do this?
 
Old 01-27-2004, 07:44 PM   #8
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Original Poster
Rep: Reputation: 30
I get an error message and it just hangs when copying /proc
414M proc
386M proc

Should I worry about this?
 
Old 01-27-2004, 08:04 PM   #9
sb73542
Member
 
Registered: Jul 2003
Distribution: Ubuntu, SUSE
Posts: 79

Rep: Reputation: 15
I just tried this today myself. I was unable to get it to work either when attempting to copy the partition that my system was booted on. I finally booted with MEPIS (similar to Knoppix) and mounted the two partitions, and copied the populated partition to the empty one, using the method already described.
 
Old 01-27-2004, 08:36 PM   #10
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Original Poster
Rep: Reputation: 30
That proably would have been cleaner, eh?

Anyways, my proc's were different, but it seems like it worked because I am wokring in the new partition now!

I'll keep the old one for a few days to make everything runs ok, but everything seems fine from here....
 
Old 01-28-2004, 12:40 AM   #11
ezra143
Member
 
Registered: Aug 2003
Location: NY
Distribution: RH9, RH8, Slack, Vector
Posts: 497

Rep: Reputation: 32
whats about mounting the new HD and then dd if=/dev/hda of=/dev/hdb and then copying over the MBR if you plan to boot off the second HD. Also, remember to edit your boootloader.
 
Old 01-28-2004, 12:57 AM   #12
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 79
Quote:
Originally posted by Tyir
I get an error message and it just hangs when copying /proc
414M proc
386M proc

Should I worry about this?
I assume you running that OS when you tried that. I would never copy files from a OS that is running, well not when cloning anyway. There will always be files that are locked, in use etc and won't copy. You should do that from a bootable CD to make sure it gets everything.

Also note, copying the files will not copy the bootloader. You will have to install that. You may need to chroot over and install it after you swap the drives and put it like the new setup.

Any of that make sense?



 
Old 01-28-2004, 09:02 AM   #13
Tyir
Member
 
Registered: Sep 2003
Distribution: Slackware 9.1 with fluxbox
Posts: 259

Original Poster
Rep: Reputation: 30
Yea, i realized after that I should have doen it from a bootable cd...but it seemed to work

I didn't hav eot worry about the bootloader, since it was in it's own partition from the start
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee SUSE / openSUSE 20 10-31-2005 07:30 AM
can i use dd to clone a partition? dr_zayus69 Linux - Software 1 01-25-2005 04:57 PM
K3B Disk Copy types: Normal vs. Clone? Bob P Linux - Software 3 10-15-2004 05:40 PM
How do clone Linux partition? samxiao Linux - Software 5 12-24-2003 07:50 PM
Disc clone/copy szak Linux - Newbie 1 01-21-2002 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:32 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
Open Source Consulting | Domain Registration