Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi folks,
On a FC3 box it has following partitions;
FC3
/root on /dev/hda5
/swap on /dev/hda3
/home on /dev/hda5BLFS
/root on /dev/hda6 (size=5G only taking up 1.5G)
/swap sharring with FC3 on /dev/hda3/dev/hda7 with ext3 not occupied (size=2G)
Now I want to duplicate another BLFS on /dev/hda7
To my knowledge following command
dd if=/dev/hda6 of=/dev/hda7 bs=4096 conv=notrunc,noerroronly works on equal size partitions. I have been searching on Internet to confirm it without result. Please advise. TIA
If the abovementioned command does not work then can I apply following method to clone /dev/hda6 on /dev/hda7 ???
1) Boot up FC3
2) # dd if=/dev/hda6 of=/home/myimage.img
(can I use /home for keeping myimage.img? It has sufficient spare space)
3) # dd if=myimage.img of=/dev/hda7
4) Modify the Bootloader (grub) of the FC3 as follow;/boot/grub/menu.lst
title Fedora Core (2.6.12-1.1378_FC3)
root (hd0,0)
kernel /vmlinuz-2.6.12-1.1378_FC3 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.12-1.1378_FC3.img
title Fedora Core (2.6.12-1.1376_FC3)
root (hd0,0)
kernel /vmlinuz-2.6.12-1.1376_FC3 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.12-1.1376_FC3.img
title LFS 6.1 (2.6.11.12)
root (hd0,5)
kernel /boot/lfskernel-2.6.11.12 ro root=/dev/hda6 vga=795
title LFS 6.1 (2.6.11.12-sound)
root (hd0,5)
kernel /boot/bzImage-2.6.11.12-sound ro root=/dev/hda6 vga=795adding: -
title LFS 6.1 (for LiveCD) (2.6.11.12-sound)
root (hd0,6)
kernel /boot/bzImage-2.6.11.12-sound ro root=/dev/hda7 vga=795OR are there any better methods? TIA
BR
satimis

Be Careful: The option “notrunc” seems to order all 5G to be continued after the end of 2G. I thought I was the onlyone doing such mistakes.
You are copying a full 5G into a 2G-partition. If you add e.g. count=480000, only the first 480000x4096 bytes will be copied, i.e less than 2G. But DD does not choose the important blocks, so you must be certain that all important data is included in the copied part of hda6. But “notrunc” seems to be inconsistent with “count=”.
The simple way is, of course, to tarball all folders and files and untar them into the new partition, with careful options, so the pointer-files are “tarred” correctly as they are. You might lose some irreal files like socks, but it has not been any problem for me (as far as I know) .
Linux-Amateur

Assuming /dev/hda7 is mounted on /mnt/hda7
cd /
find root -depth -xdev|cpio -pdvm /mnt/hda7this copies everyhing except symolically linked directories.

Hi folks,
Tks for your advice.
I need to duplicate the complete OS (BLFS) on /dev/hda7 making it working there.
Linux Amateur,
Can following tar command work for me?
tar -C / -lcpvf- | tar -C /mnt/livecd -xf -
are the flags correct? /mnt/livecd=/dev/hda7dlonra (by Dlonra)
To include copying all symolically linked directories, which additional flags should be up as well. Otherwise it won't be a working OS on /dev/hda7TIA
B.R.
satimis

You must boot in the FC3 system. In the FC3-system you must mount both involved partitions
e.g. as /tmp/hda6 and /tmp/hda7I suppose FC:s GUI – partitionmanager can do this,
otherwise: mkdir /tmp/hda6
mount /dev/hda6 /tmp/hda6
mkdir /tmp/hda7
mount [-t ext3] /dev/hda7 /tmp/hda7As root:
copy all of the topfolders /bin, /boot, /dev, /etc, /home....... from BLFS to the new partition hda7.In order to copy the /home folder, for example:
move yourself into the BLFS-root
tarball the /home folder (dont worry about the warning of missing “/” )
move the tarball to the new partition
move yourself into the new partitions root-
folder (so you get back the missing “/” )
untar the tarballthat is: cd /tmp/hda6
tar -cf home.tar home
mv home.tar /tmp/hda7
cd /tmp/hda7
tar -xf home.tarand the same for the other folders.
With this method you have control over each step. But it can certainly be done more elegantly.
Linux-Amateur

my description on symbolically linked directories was misleading -
the links are copied, but the contents are not- in almost all cases, this is what you want when you do a partition copy.check the copied /etc/fstab for explicit references to /dev/hda5. If present, change to hda7. Also check that swap is where you want it.

Question to Dlonra
Am I right to assume, that your commands are run from the system that is copied ? (in this case BLFS)
Does your elegant solution move all sockets ?
My solution drops the empty sockets, and I have a nagging feeling that I might get future problems, although it seems to work without them.
Linux-Amateur

Hi linux-amateur,
Tks for your detail advice.
> I suppose FC:s GUI – partitionmanager can do
> this,# yum search "GUI - partitionmanager"
# yum search "GUI partitionmanager"
# yum search partitionmanager
could not find it.After mounting both /dev/hda6 and /dev/hda7 starting Konqueror can do the job with drag-and-drop action.
Why it is necessary to tar /home of /dev/hda6 (BLFS)? Copy the rest directories straight to /dev/hda7 without compressing them? What will be the advantage of this arrangement.
B.R.
satimis

Hi dlonra,
Your further advice noted with thanks.
> the links are copied, but the contents are
> not- in almost all cases, this is what you
> want when you do a partition copy.Please explain what does it mean "but the contents are not- in almost all cases".
TIA
B.R
satimis

I worked from outside the moving rootpartition, because it was necessary in MS-windows. I don't know if it is needed in Linux, but it is less trouble than finding out if it is needed.
I copied tarballs instead of the directories directly, to avoid that some files might get copied in place of their links, including the mounted DVD-rom.
But the superior method is the one suggested by Dlora. I tried Dlora's method this morning and it seemed to give a perfect copy. But it has a writing error. You must write the “/” (slash) (or the full address of the mounted source-partition), instead of the word “root”. Otherways you only get the /root directory copied.
Many thanks to Dlora, and to you. This has been most valuable for me also.
Linux-Amateur

Don´t forget to edit your /mnt/livecd/etc/fstab before logging out after the copying.
The /dev/hda5 (or /dev/hda6 ), on the line of the rootpartition, must of course be changed to /dev/hda7.
P.S. I write this, having logged into the trial-partition that I copied this morning. I had some minor problems because I had been sloppy with the fstab, but now it works exactly as the original.
Linux-Amateur

Hi Linux-Amateur,
> You must write the “/” (slash) (or the full
> address of the mounted source-partition)You meant the command line should read;
# find / -depth -xdev|cpio -pdvm /mnt/hda7
???
Others noted with tks.
BR
satimis

Yes
In the /etc/fstab:
If you change the line of the rootpartition from /dev/hda6 to /dev/hda7, you also need to remove or change the line with the /mnt/hda7 ( or /mnt/livecd.)If the KDE gets crazy, or if it refuses to mount your home-partition, it is probably due to the fstab-file.
Linux-Amateur

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |