Moving / mountpoint

Garry Harthill gazzerh at gmail.com
Thu Aug 18 16:31:47 UTC 2005


On 18/08/05, Paul Howarth <paul at city-fan.org> wrote:
> > dd is IMHO a bad option.  It makes an EXACT image of the partiton named,
> > including the size of the partition.  For example, "dd if=/dev/hdc1
> > of=/dev/hdd2" will create a partiton content of hdd2 that is exactly,
> > bit for bit, an image of the original.  Then the extra steps of resizing
> > and relabeling are required.  It also copies every byte of the source,
> > whether data is there or not, which is inefficient on a filesystem that
> > has a significant amount of free space.
> 
> It's true that dd would copy the empty space too. However, it would be
> so much faster that I'd wager that in most cases where the filesystem
> isn't less than say 30% full dd would still be faster than cp because it
> doesn't have to navigate the filesystem, issue system calls to get each
> file or directory's owner, permissions, last-modified times etc. and
> then set them on the copy.
> 
> > Why not use "cp -a" since that will copy everything, recursively, and
> > will retain all the filesystem permissions, (it is after all designed to
> > make an archive copy).  It does require that the new filesystem be
> > already formatted, but that is simple and likely already done anyway.
> > It does not require relabeling the partition either. A single command
> > instead of at least 3 as you list above.
> 
> Starting from rescue mode (we're copying the root partition remember),
> with the new partition created:
> 
> dd method:
> - run dd to copy data
> - run resize2fs to fix up partition size
> - run tune2fs to set label
> 
> cp method:
> - run mkfs to create new filesystem and set label
> - mount old and new filesystems (not needed for dd)
> - run cp to copy data
> 
> Moreover, "cp -a" will copy the data from all mounted filesystems under
> the starting point, so if you've mounted all original filesystems (the
> rescue CD would offer to do that), you'd potentially be copying more
> than just the original partition. The dd method does not have this
> issue.
> 
> > I am a fan of doing things in the simplest and most efficient way
> > possible.
> 
> Me too :-)
> 
> Paul.

I went with the cp -a option. The copy did take a while (i went out to
lunch while it was copying :)

I just didn't like the idea of dd then resizing it when i had a
perfectly acceptable partition sitting there and begging to be used.

Rescue doesn't mount anything so there is no danger of copying other
mounted file systems. You have to mount it all manually.




More information about the fedora-list mailing list