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.
What has happened to the ability to use "of=/dev/sr0"? I am certain that I used to be able to burn an image directly to a CD/DVD with "dd", but now it always complains that "/dev/sr0" is a read-only filesystem. Have I lost my mind and this was never possible?
Click here to see the post LQ members have rated as the most helpful post in this thread.
What has happened to the ability to use "of=/dev/sr0"? I am certain that I used to be able to burn an image directly to a CD/DVD with "dd", but now it always complains that "/dev/sr0" is a read-only filesystem. Have I lost my mind and this was never possible?
AFAIK, only DVD-RAM disks could be written to that simply.
first of all : a very very happy new year to all of you!
have to save the data of a lenovo-notebook: want to achive that with knoppix.
what is aimed: how to do with knoppix a dd on windows machine with nine (9) partitions
the notebook: lenovo G 780 Notebook
the os: windows 8
To senior Linux techies..
I got my PC troubleshooting bootable USB 8GB with parted magic, kali and few other isos by yumi utilities, it boots and works well. But now i want to migrate image of it to new USB flash disk 32GB.
i made image of it on my Ubuntu machine and now want to transfer it to new one.
I tried using your dd examples, but it works out 8gb capacity on new disk wasting lots of memory space but it boots. I tried to expand this partition using gparted but it ruins the bootable option.
I guess as per your words i need to use :
dd if=/dev/sda skip=1 of=/dev/sdb seek=1 bs=4k conv=noerror (good when u have two devices but i got one image and new usb left)
if yes, it all good but to further challenge, i already image as usb_8g.img on my desktop and i need to move it to bigger usb_32gb. (after making image, i formatted my usb_8gb
Regards
Ron
Quote:
Originally Posted by AwesomeMachine
The only difference between a big partition and a small partition, besides size, is the partition table. If you are copying say sda to sdb, an entire drive with a single partition, sdb being smaller than sda, then you have to do:
You can put the skip and seek anywhere you want, I just put them there to show what they go to. Skip skips input blocks at the beginning of the media(sda). Seek skips over so many blocks on the output media before writing(sdb). By doing this, you leave the first 4k bytes on each drive the same. This is eight sectors. The first sector is the Master Boot Record (MBR). This contains the partition table. You don't want to tell a drive it is bigger than it really is by writing a partition table from a larger drive to a smaller drive. In my example, we wanted to use a byte size (bs) of 4k or 4096 bytes. This speeds up the copy from the default 512 byte bs. But, your are limited in how small of a skip or seek you can make. In this example, the smallest skip or seek is 1, or 4096 bytes. Since the first 63 sectors of the drives are empty, except sector 1, the MBR, we can skip eight sectors without any problem missing part of the boot sector. One sector on a hard drive is 512 bytes.
Now, if you are copying say sda3 to sda2, this is different. What you want to do is this:
dd if=/dev/sda3 of=/dev/sda2 bs=4096 conv=noerror
Even if these are primary partitions, they are still logical to the main partition. Do not use the conv=notrunc option. Without notrunc, multiple blocks of zeros get abbreviated with a string of asterisks, saving a lot of space. if you use notrunc, all the zeros will be written out. On a smaller partition you want to save room. If you write out all the zeros, the smaller partition won't be big enough.
Awesome writeup of dd. I found it when trying to use dd to make a sparse file, when cloning MBR and first partition of disk. When I scroll through results from
Code:
man dd
I see a list of symbols that can be used with conv=, and one of the symbols listed is sparse:
Code:
sparse try to seek rather than write the output for NUL input blocks
. However, when I try to make use of this, I get error:
Code:
dd: invalid argument 'sparse' to 'conv'
I am trying to build a custom slackware64-14.1 image for google cloud compute engine, following documentation at https://cloud.google.com/compute/doc...uilding-images. I started up an extra laptop with slackware usb-installer, and used fdisk to create one 10G partition; I used setup and installed all the slackware sets, except for KDE, KDEI, X, XAP, and Y...; I configured grub instead of lilo, and booted into new installation. Then I rebuilt kernel and configured system according to google documentation above, and system reboots into new kernel: so far so good.
Now I started back up from the slackware USB installer, which has 9GB free space left on the thumb drive, and I want to create a sparse image from my 10GB partition, and I want the image to include the MBR, I want it to be called disk.raw, and I want to save it on the USB drive.
I mounted the thumb drive to /mnt.
The command I concocted that doesn't work is as follows:
The option for the dd command should of course be at the end of the dd command rather than at the end of the gzip command.
I mention this only to assist others who may use the command, and it is in no way a criticism of an outstanding guide to the dd command which I have referred to on many occasions. Thank you!
And that is still wrong. If there is any error reading the source, the rest of the stream will just be shifted over to fill in the unreadable gap, and the result will be a badly corrupted filesystem image. (I'm tempted to say "hopelessly corrupted," but careful forensic detective work could create a sane image.) You absolutely need the "sync" conversion too so that the missing block will be filled in with zeros.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Quote:
Originally Posted by slac-in-the-box
Hello LQ world:
Awesome writeup of dd. I found it when trying to use dd to make a sparse file, when cloning MBR and first partition of disk. When I scroll through results from
Code:
man dd
I see a list of symbols that can be used with conv=, and one of the symbols listed is sparse:
Code:
sparse try to seek rather than write the output for NUL input blocks
. However, when I try to make use of this, I get error:
Code:
dd: invalid argument 'sparse' to 'conv'
I am trying to build a custom slackware64-14.1 image for google cloud compute engine, following documentation at https://cloud.google.com/compute/doc...uilding-images. I started up an extra laptop with slackware usb-installer, and used fdisk to create one 10G partition; I used setup and installed all the slackware sets, except for KDE, KDEI, X, XAP, and Y...; I configured grub instead of lilo, and booted into new installation. Then I rebuilt kernel and configured system according to google documentation above, and system reboots into new kernel: so far so good.
Now I started back up from the slackware USB installer, which has 9GB free space left on the thumb drive, and I want to create a sparse image from my 10GB partition, and I want the image to include the MBR, I want it to be called disk.raw, and I want to save it on the USB drive.
I mounted the thumb drive to /mnt.
The command I concocted that doesn't work is as follows:
Does dd actually work with conv=sparse? How do I do it?
Hi,
'sparse is not one of the 'dd' convert (conv) arguments. A sparse file is like a place marker on the disk. It is a file that at least some of it contains nothing.
makes a file of 0B that can be filled up to 45MB, but only consumes the disk space of the current size of its contents. That's how the virtual machine disks usually are created.
If you simply want to write one disk partition to another, try:
The option for the dd command should of course be at the end of the dd command rather than at the end of the gzip command.
I mention this only to assist others who may use the command, and it is in no way a criticism of an outstanding guide to the dd command which I have referred to on many occasions. Thank you!
The
Code:
conv=noerror
is superfluous to the subject. Usually dd will stop on an error. If the
Code:
conv=noerror
conversion flag is used, if dd encounters an error it continues to run while outputting a message each time it encounters an error. Either command should work on a healthy drive.
If it only works with the 'noerror' flag, then the compressed image may be flawed. It's always a bad sign when you have to use 'noerror' to get 'dd' to work.
I have not found a good use for this conversion flag since the program
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.