Fedora Linux Support Community & Resources Center
  #1  
Old 9th March 2012, 10:15 PM
toddbailey Offline
Registered User
 
Join Date: Aug 2009
Posts: 146
windows_xp_2003ie
Methods to partly clone a device

Hi All,


I have a disk partition (/) want to copy to a smaller drive.
I checked and it appears the dd command won't work, it wants a larger destination device.

I want to go the other direction, I basically want to copy the / partition off a 300 gb drive to a 30 gig drive.
the actual space used is in the order of 20-25 gb

I'm was planning to boot using a thumb drive so the source and destination won't be mounted unless necessary

The destination device is partitioned with a boot and / already,
I don't know if a cp command will work

I'm ok over writing the destination device completely but think it's un-necessary, both devices have the same version/archit. installed and I just need to overwrite the existing / partition from the source

Is tar and rsync the only methods to use? which is the better/ easier to utilize?


thanks

Last edited by toddbailey; 9th March 2012 at 10:22 PM.
Reply With Quote
  #2  
Old 9th March 2012, 10:24 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfirefox
Re: Methods to partly clone a device

Personally, I think tar is better. But that is my opinion, and there have been good results reported with rsync.
Reply With Quote
  #3  
Old 9th March 2012, 11:05 PM
toddbailey Offline
Registered User
 
Join Date: Aug 2009
Posts: 146
windows_xp_2003ie
Re: Methods to partly clone a device

I've been googling the topic and can't I just use a cp -pr /source /destination or am I missing something?
Reply With Quote
  #4  
Old 10th March 2012, 12:30 AM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,832
linuxfirefox
Re: Methods to partly clone a device

Yes you can use "cp -pr". Just make sure you create the new FS with the correct parameters.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #5  
Old 10th March 2012, 12:36 AM
DrHappyAngry Offline
Registered User
 
Join Date: Jan 2012
Location: Seattle
Posts: 19
linuxfirefox
Re: Methods to partly clone a device

Well if you're planning on booting from that other drive you'll need to edit the fstab in the new install, as well as install the bootloader to that drive. I think it's just "grub-instal /dev/sdX" where sdX is the drive you want to install to. To find the UUID of the new partitions on the new drive run "blkid" and change the uuid for / to the one you got from blkid.
Reply With Quote
  #6  
Old 10th March 2012, 08:24 AM
toddbailey Offline
Registered User
 
Join Date: Aug 2009
Posts: 146
linuxfedorafirefox
Re: Methods to partly clone a device

So much for "easy" I (finally) got rsync to copy, and after a few iterations, I get to a boot sequence only to fail with a message

unable to find root partition, sleeping for ever, which considering the time I think I'll take the hint and try again tomorrow


The command I used was rsync -avHx --delete source destination

I edited the fstab and updated the UUID to the values reported from ls -l /dev/disks/by-uuid taked from usb key
when that didn't work I tried to state by device /dev/sda1 /boot & /dev/sda2 / etc.

---------- Post added at 12:24 AM ---------- Previous post was at 12:22 AM ----------

Quote:
Originally Posted by DrHappyAngry View Post
Well if you're planning on booting from that other drive you'll need to edit the fstab in the new install, as well as install the bootloader to that drive. I think it's just "grub-instal /dev/sdX" where sdX is the drive you want to install to. To find the UUID of the new partitions on the new drive run "blkid" and change the uuid for / to the one you got from blkid.
the "new" drive already has grub loaded, like I said both disks boot, I just wanted to take a fully configured system disk and copy it to the new ssd drive.
Reply With Quote
  #7  
Old 10th March 2012, 02:48 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfirefox
Re: Methods to partly clone a device

Quote:
Originally Posted by toddbailey View Post
I've been googling the topic and can't I just use a cp -pr /source /destination or am I missing something?
I would say use "cp --preserve=all -Pr".

Using just -p only saves the mode, ownership, and timestamps. The files also have a security label that needs to be saved. Of course, you could run a "restorecon /" after you boot the copied system (or add a "touch .autorelable" in the new root filesystem), but saving the labels is faster.
Reply With Quote
  #8  
Old 10th March 2012, 05:21 PM
toddbailey Offline
Registered User
 
Join Date: Aug 2009
Posts: 146
linuxsafari
Talking Re: Methods to partly clone a device

problem solved:

I failed to notice there is a root uuid entry in grub.conf.
a simple edit and a reboot and now the machine boots with it's new drive.


next project to apply SSD settings and move r/w folders to the secondary drive.

for those who want to try this here are the steps in brief I used.

setup drive to clone to
boot using a usb key
creat folder in mnt ie src and dest
mount source and dest devices
run rsync
get device id's
edit fstab and grub and update the uuid entries.

pretty simple after a few failed attemps....
Reply With Quote
Reply

Tags
clone, clone to smaller device, device, methods, partly

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Partly wireless network? Harold Smith Servers & Networking 3 17th February 2011 08:45 PM
Partly torrent download shovan@hantu Servers & Networking 3 24th February 2009 11:51 PM
iptables: RH chain: mystery of 224.0.0.251 & 224.0.0.22 partly solved & partly open Nick Levinson Security and Privacy 1 17th February 2009 04:38 PM
RealPlayer only partly working John the train Using Fedora 2 29th September 2006 01:01 PM
Advice on device driver debugging methods mitaiwan82 Using Fedora 2 13th May 2005 08:51 PM


Current GMT-time: 03:47 (Friday, 19-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat