Fedora Linux Support Community & Resources Center
  #1  
Old 18th May 2012, 07:57 PM
Dan's Avatar
Dan Offline
Administrator
 
Join Date: Jun 2006
Location: Paris, TX
Posts: 22,309
linuxfirefox
Question Because it's there ...

... and 'cuz I'm both cheap and lazy.


The 411


The players:
  • An older PATA Maxtor (3.5 desktop type) 120g currently housing my F16 install. (Which was supposed to be a temporary disposable install ... six months ago. <....> )
  • A currently empty SATA 500g Hitachi (2.5 - notebook type) spare drive laying in a desk drawer. <....>
  • dd? <....>

Mitigating factors:
  • The PATA Maxtor is getting pretty long in the tooth, and I'm actually starting to value and use that F16 install more than my good old standby F11 drive. <....>
  • I am completely unwilling to overwrite the F11 install. Most of my current and short-term archived data is living there.
  • I'm decidedly lazy. I don't want to have to do another complete re-install. <....>
  • The Hitachi is obviously lazier than I am. Right now, it's doing nothing. <....>
  • I haven't seriously broken an install in over two weeks now. <....>
  • The existing partitioning on the Maxtor is a basic boot, /(root), and swap setup, all primary partitions. (Sadly, I didn't build in a separate /home partition.)


The Proposed Action Plan:
  • Rumor has it that dd can be used to "ghost" the contents of the Maxtor to the Hitachi ...
  • ... and then the filesystem can be "grown" into the extra empty space.
  • The Maxtor can then be "retired" to experimenting with the perpetual flow of new fedora vunderborks.

The mounting of the 2.5 in a 3.5 slot is not an issue. I have a roll of 2" packing tape, a fresh bag of cable ties and a big box of rubber bands. <....>

So ...

QTBAs:
  • What kinds of pitfalls can I expect to run into here?
  • How to prepare for same, and avoid them? (if possible.)
  • Will I actually be better off to just byte the big time-filled techno-twinkie and slog my way through a fresh install and download/install all the applications, tweaks, and data into the new Hitachi -- all over again?
  • Would I be better off in the long run to forget about the Hitachi, and grab a new ~500+g SATA 3.5 inch drive and use it instead? ie. Will the 2.5 have the needed durability/longevity?


Thank you for looking in, and thanks for your insight, input and suggestions.
__________________
Signature Links | New Posts | Who's on the forums (right now) |

© ® ™ № ¿
Reply With Quote
  #2  
Old 18th May 2012, 09:04 PM
Yellowman
Guest
 
Posts: n/a
linuxfirefox
Re: Because it's there ...

Quote:
Originally Posted by Dan View Post
... and 'cuz I'm both cheap and lazy.


The 411


The players:
  • An older PATA Maxtor (3.5 desktop type) 120g currently housing my F16 install. (Which was supposed to be a temporary disposable install ... six months ago. <....> )
  • A currently empty SATA 500g Hitachi (2.5 - notebook type) spare drive laying in a desk drawer. <....>
  • dd? <....>

Mitigating factors:
  • The PATA Maxtor is getting pretty long in the tooth, and I'm actually starting to value and use that F16 install more than my good old standby F11 drive. <....>
  • I am completely unwilling to overwrite the F11 install. Most of my current and short-term archived data is living there.
  • I'm decidedly lazy. I don't want to have to do another complete re-install. <....>
  • The Hitachi is obviously lazier than I am. Right now, it's doing nothing. <....>
  • I haven't seriously broken an install in over two weeks now. <....>
  • The existing partitioning on the Maxtor is a basic boot, /(root), and swap setup, all primary partitions. (Sadly, I didn't build in a separate /home partition.)


The Proposed Action Plan:
  • Rumor has it that dd can be used to "ghost" the contents of the Maxtor to the Hitachi ...
  • ... and then the filesystem can be "grown" into the extra empty space.
  • The Maxtor can then be "retired" to experimenting with the perpetual flow of new fedora vunderborks.

The mounting of the 2.5 in a 3.5 slot is not an issue. I have a roll of 2" packing tape, a fresh bag of cable ties and a big box of rubber bands. <....>

So ...

QTBAs:
  • What kinds of pitfalls can I expect to run into here?
  • How to prepare for same, and avoid them? (if possible.)
  • Will I actually be better off to just byte the big time-filled techno-twinkie and slog my way through a fresh install and download/install all the applications, tweaks, and data into the new Hitachi -- all over again?
  • Would I be better off in the long run to forget about the Hitachi, and grab a new ~500+g SATA 3.5 inch drive and use it instead? ie. Will the 2.5 have the needed durability/longevity?


Thank you for looking in, and thanks for your insight, input and suggestions.
Use gparted to copy the partition instead (this doesn't apply for that lvm crap ) .
Reply With Quote
  #3  
Old 18th May 2012, 09:20 PM
Dan's Avatar
Dan Offline
Administrator
 
Join Date: Jun 2006
Location: Paris, TX
Posts: 22,309
linuxfirefox
Re: Because it's there ...

<....> Uhm ... I didn't know you could do that with gparted. (I guess I never looked at it that hard.) That simplifies things. <....>
__________________
Signature Links | New Posts | Who's on the forums (right now) |

© ® ™ № ¿
Reply With Quote
  #4  
Old 18th May 2012, 10:37 PM
Doug G Offline
Registered User
 
Join Date: Jul 2005
Posts: 640
windows_7firefox
Re: Because it's there ...

If you dd the entire disk image and restore it to the new drive, you will end up with the new drive being an exact clone of the old drive and the remaining space unallocated. You can simply boot off the new drive and then deal with using the additional space by making new partitions, expanding existing partitions, etc.

One possible problem is the disk UUID is copied if you clone the entire drive.

I don't think there are any problems cloning pata to sata.
__________________
======
Doug G
======
Reply With Quote
  #5  
Old 18th May 2012, 10:39 PM
Dan's Avatar
Dan Offline
Administrator
 
Join Date: Jun 2006
Location: Paris, TX
Posts: 22,309
linuxfirefox
Re: Because it's there ...

Quote:
One possible problem is the disk UUID is copied if you clone the entire drive.
That was one of my concerns.
__________________
Signature Links | New Posts | Who's on the forums (right now) |

© ® ™ № ¿
Reply With Quote
  #6  
Old 19th May 2012, 03:06 AM
Doug G Offline
Registered User
 
Join Date: Jul 2005
Posts: 640
windows_7firefox
Re: Because it's there ...

Quote:
Originally Posted by Dan View Post
That was one of my concerns.
I've used entire drive dd fairly often, and never had a problem cloning the UUID, but the drives I replaced were taken out of service and nothing else I use seemed to mind. I could see problems if you left the old drive in service on the network along with the new drive.
__________________
======
Doug G
======
Reply With Quote
  #7  
Old 19th May 2012, 03:38 AM
Dan's Avatar
Dan Offline
Administrator
 
Join Date: Jun 2006
Location: Paris, TX
Posts: 22,309
linuxfirefox
Re: Because it's there ...

They'll both end up not only on the same network ... but likely in the same box.
__________________
Signature Links | New Posts | Who's on the forums (right now) |

© ® ™ № ¿
Reply With Quote
  #8  
Old 19th May 2012, 03:57 AM
Misfit138's Avatar
Misfit138 Offline
Registered User
 
Join Date: Feb 2011
Location: USA
Posts: 42
linuxchrome
Re: Because it's there ...

Don't use dd...just use cp -a. dd is unnecessary and clunky for copying the contents of a drive.
Also, why not use human readable disk labels, rather than UUID- namely /dev/disk/by-label/

Recommended reading- https://wiki.archlinux.org/index.php...oning#Using_cp
and https://wiki.archlinux.org/index.php..._device_naming

enjoy
__________________
“There are two ways to get enough. One is to continue to accumulate more and more. The other is to desire less.”
― G.K. Chesterton
Reply With Quote
  #9  
Old 19th May 2012, 10:32 AM
Dutchy Offline
Registered User
 
Join Date: Aug 2011
Posts: 694
linuxsafari
Re: Because it's there ...

Cp isn't fit for copying file systems.
Also with a blocklevel kind of copy like dd the uuids won't change (also, dd is very powerful but I prefer things like clonezilla for this task).
One thing to consider is the place you installed the bootloader to and if it needs to be changed.
Reply With Quote
  #10  
Old 19th May 2012, 11:26 AM
jamielinux Offline
Registered User
 
Join Date: Jun 2011
Posts: 64
linuxfirefox
Re: Because it's there ...

I've had lots of success doing this to clone a hard drive:
Code:
dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc
UUIDs will be the same, but if you're going to be reformatting the Maxtor (or at least reformatting each partition), then it'll get new UUIDs anyway and you can carry on using it on the same box.

I wouldn't advise using cp at all, and it can't copy over the MBR anyway so you'll have to use dd for that.
Reply With Quote
  #11  
Old 19th May 2012, 08:35 PM
Misfit138's Avatar
Misfit138 Offline
Registered User
 
Join Date: Feb 2011
Location: USA
Posts: 42
linuxchrome
Re: Because it's there ...

I recommend cp -a.

Pros:
*allows for a filesystem change from source to destination e.g. source: ext3 dest: xfs
*allows for easy transition for drives of different sizes, without unnecessarily coping empty sectors
*is generally faster
*will simultaneously defrag the filesystem
*It is arguably harder to destroy an entire drive with a typo

Cons:
*requires subsequent manual installation and configuration of bootloader
*does not clone UUIDs, but I do not recommend using UUID as they are not human readable

I have used cp -a with 100% success for many years for the very purpose of cloning countless filesystems, many in excess of 100GB.

I do not recommend using dd, even with bs=4096, as it will be achingly slow and will mindlessly copy all sectors unnecessarily, hence my description as "clunky".
__________________
“There are two ways to get enough. One is to continue to accumulate more and more. The other is to desire less.”
― G.K. Chesterton
Reply With Quote
  #12  
Old 19th May 2012, 08:56 PM
errorxp's Avatar
errorxp Offline
Registered User
 
Join Date: Jul 2007
Posts: 371
linuxfirefox
Re: Because it's there ...

I use dd_rescue to create a blind copy of a harddrive.

Code:
dd_rescue /dev/sda /dev/sdb
__________________
these command lines are like casino slot machines, every time I input commands NOTHING HAPPENS
Reply With Quote
  #13  
Old 19th May 2012, 08:58 PM
Dan's Avatar
Dan Offline
Administrator
 
Join Date: Jun 2006
Location: Paris, TX
Posts: 22,309
linuxubuntufirefox
Re: Because it's there ...

Okay.

Don't let this bag of popcorn fool you, guys. I'm here, I'm awake, I'm paying attention ... and learning.
__________________
Signature Links | New Posts | Who's on the forums (right now) |

© ® ™ № ¿
Reply With Quote
  #14  
Old 21st May 2012, 04:35 PM
Gareth Jones Offline
Official Gnome 3 Sales Rep. (and Adminstrator)
 
Join Date: Jul 2011
Location: Leamington Spa, UK
Age: 30
Posts: 1,689
linuxfirefox
Re: Because it's there ...

I'd go with "cp -a" normally, (the free defrag if it's an old install is nice, and not copying unused blocks speeds things up, also you'll get the optimum FS parameters for the size of partition according to mkfs), but I'm not sure how that plays with SELinux. (I really must learn this SELinux stuff properly one of these days!) The cp manual page claims that cp knows about extended attributes though, and SELinux/ACLs are just special cases of them so it should work. You can set the UUIDs directly when formatting the new file-systems if you want the same ones used on the new partitions (-U option of mkfs.ext*, not sure about other mkfses). You'll have to install GRUB in the MBR though.

Actually, even if you want to image the partitions byte-for-byte, I'd just use "cp orig_dev new_dev" rather than dd, but that's just my taste. I only resort to dd if I actually care about block-sizes, offsets or counts (i.e. hardly ever) – I'd prefer the system to just get on with it rather than me worry about what block-size is most efficient on the hardware concerned... Then enlarge the partitions with gparted or the partitioner of your choice. If you don't use GParted, you'll also have to resize the file-systems with resize2fs, which defaults to the current partition size so doesn't need a size parameter unless you're shrinking the file-system.
Reply With Quote
  #15  
Old 22nd May 2012, 03:41 PM
DBelton's Avatar
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 6,613
linuxfirefox
Re: Because it's there ...

the -a parameter on the cp command tells it to preserve attributes and selinux context.

Normally, cp will set the selinux context to the context of the destination unless you tell it to preserve the original context. The -a parameter is really the same as using -dR --preserve=all.

Edit:

I would still run a complete selinux relabel on the first boot after copying the drive anyway.

Last edited by DBelton; 22nd May 2012 at 03:48 PM.
Reply With Quote
Reply

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


Current GMT-time: 06:44 (Saturday, 18-05-2013)

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