Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
I am not aware of a dd parameter that specifies the data transfer rate. It goes as fast as it can. The bs parameter in my example indicates the amount of data tranferred by a single read and write request. The larger it is, the fewer I/O requests are generated, leading to less overhead and better performance.
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. :-)
Mounting is for filesystems.
dd does not (necessarily) deal with filesystems, mounting is not required, might even be harmful to write operations.
Quote:
Originally Posted by berndbausch
I am not aware of a dd parameter that specifies the data transfer rate. It goes as fast as it can. The bs parameter in my example indicates the amount of data tranferred by a single read and write request. The larger it is, the fewer I/O requests are generated, leading to less overhead and better performance.
That said, the default blocksize is so small that it will go significantly slower.
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.
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.
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.
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?
With 2G memory you would be ahead to check how much memory is actually free with the system operating. Use the "free" command and it will tell you how much is available, used, free, and more. I would suggest using any block size you choose up to about half of the free memory number, although you should make it in increments of 1K multiples. If your memory starts to get full then it will begin to swap excessively and really slow things down.
As has already been mentioned, having both source and destination unmounted is best.
With 2G memory you would be ahead to check how much memory is actually free with the system operating. Use the "free" command and it will tell you how much is available, used, free, and more. I would suggest using any block size you choose up to about half of the free memory number, although you should make it in increments of 1K multiples. If your memory starts to get full then it will begin to swap excessively and really slow things down.
As has already been mentioned, having both source and destination unmounted is best.
Computersavvy, I somehow missed your response at the time. However, I am still grateful
for the input - have used the "free" command and all appears OK. My belated thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.