Qustions re using 'dd' command
Hello
I'm intending to use the 'dd' command to transfer a Linux installation from one USB to another USB. The target partition will be slightly larger than the source partition. I have researched the details of the command and triple checked with other reliable sources. However, there are a couple of questions I need answered before I begin. I will use a host system, plug in the source USB and once it's mounted plug in the target USB & run the command from the host system. Process will be performed on a fairly basic machine with just 2GB ram. First question: do both USBs need to be mounted or, just the source USB? Logic suggests they should both be mounted, but logic without experience is why a worthwhile forum such as LQ is necessary. :-) Second question - the numerical figure in the command to specify the data transfer rate - should that be kept to a fairly low level (say, 4096) to ensure accuracy? The source partition is about 12GB. thanks DownSouth |
If the source device is being written to during copying you may will end up with corrupted target filesystem, so the source device must be either not mounted at all or mounted read-only. Target must not be mounted as modifying a mounted filesystem bypassing its driver will result in all sorts of nasty consequences. If target device is larger you will have to resize partitions and filesystems after copying to utilize all available space. Restricting bandwidth will not affect copying accuracy, its primary and only goal is to manage system load.
|
If you want to copy one partition (e.g. /dev/sdb1) to another (e.g. /dev/sdc1), neither the source nor the target should be mounted. The command would be something like
Code:
dd if=/dev/sdb1 of=/dev/sdc1 bs=1M |
Quote:
dd does not (necessarily) deal with filesystems, mounting is not required, might even be harmful to write operations. Quote:
I usually use bs=4M, but if there's enough memory one could go int GBs... e.g. bs=1G This does not affect accuracy in any way whatsoever. dd is always bit-precise. |
Many thanks for the detailed responses, everyone.
Just one more question - bs=4M, given that the host machine only has 2GB ram could I (safely) raise that to bs=10M? Thinking of the other comment that the less I/O requests there are the better the performance. Or, would keeping to bs=4M be recommended for that machine? |
The bs parameter is merely logical - I did some low-level tracing and it appears to make no difference to the actual physical I/O performed. I use 4M on much larger systems, purely out of habit.
|
Quote:
|
Quote:
As has already been mentioned, having both source and destination unmounted is best. |
Quote:
for the input - have used the "free" command and all appears OK. My belated thanks. |
All times are GMT -5. The time now is 08:51 AM. |