Re: dd and cp -a

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Karl Larsen wrote:
> 
>     I have this computer on /dev/sda and the new hard drive is /dev/sdb. 
> This F7 is all in /dev/sda6 and I want to copy /dev/sda6 to /dev/sdb5. I 
> tried dd but it failed I think because /dev/sdb5 is smaller 10 GB than  
> /dev/sda6 which is 30 GB. It ended with an error message.
> 
>     So back to cp -a but there is a hitch. I redid /sdb5 with another 
> ext3 file system and I can mount it to /mnt on this computer. So it is 
> easy to cp all from /dev/sda6 to /dev/sdb5 but, with a simple # cp -a / 
> /mnt it will do all that fine but then want to copy /mnt to the new 
> /dev/sdb5.
> 
>     Does anyone know a secret that will work? I will read man cp again :-)
> 

 1 - make sure the target partition (/dev/sdb5 from the looks of things) is
     AS LARGE OR LARGER than /dev/sda6.

       You can do this check by:
        $ su                      # become root
        # fdisk /dev/sda
        ...
        Command (m for help): p   # you enter the "p" part at the end
        ...
        Command (m for help): q   # you enter the "q" part at the end
        # fdisk /dev/sdb
        ...
        Command (m for help): p   # you enter the "p" part at the end
        ...
        Command (m for help): q   # you enter the "q" part at the end
        # 

     then compare the "Blocks" column entry for /dev/sda6 and /dev/sdb5,
     making sure the one for sdb5 is larger.

 2 - Make a clean partition on /dev/sdb5:
        # mkfs -t ext3 /dev/sdb5

 3 - Check the partition you just made:
        # fsck -f /dev/sdb5

 4 - Mount the new partition:
        # mount /dev/sdb5 /mnt

 5 - Copy over everything from sda6 to sdb5
        # cd $MOUNT_POINT_FOR_sda6    # probably "/"
        # find . -mount -print | grep -v '^./lost+found' | cpio -pdumva /mnt


Cpio will preserve any hard and soft links it finds and will also
correctly copy any device nodes.  I'm not totally sure you can say that
about "cp -a".  As above, the find command piped into cpio will also
preserve any mount points, but not try to copy the stuff inside the
mount point.  Note also the "grep -v '^./lost+found" part of the pipe
prevents copying over any bad/orphaned files from sda6 to sdb5.

BTW: using dd(1) on two different partitions usually results in the "of="
partition thinking it's the same size as the "if=" partition.  When the
"of=" partition is the smaller of the two, this means trouble later on.
When the "of=" partition is the larger of the two, you'll end up wasting
some disk space.  Most of this kind of issue is fixable in file-system
editors, but these are pretty much "guru only" sorts of tools, too.


Hope this helps'idly,

-S

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux