Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Are you purposely trying to create a sparse file (aka a file with holes in it)? Because that's what you appear to be doing. You're telling dd to skip 1000000 size 2048 blocks and then add 0 count blocks at the end. Why not try:
dd if=/dev/zero of=img bs=2048 count=1000000
That creates a zeroed out file with 1 million 2 KB blocks, which is 2 million KB or roughly 2 GB. Remember, a kilobyte is 1024 bytes (not 1000), i.e. it's based on base 2, not base 10, and so on with megabytes, gigabyes, etc. This is why the number can look slightly off of what you expect.
Originally posted by btmiller Are you purposely trying to create a sparse file (aka a file with holes in it)? Because that's what you appear to be doing. You're telling dd to skip 1000000 size 2048 blocks and then add 0 count blocks at the end. Why not try:
dd if=/dev/zero of=img bs=2048 count=1000000
That creates a zeroed out file with 1 million 2 KB blocks, which is 2 million KB or roughly 2 GB. Remember, a kilobyte is 1024 bytes (not 1000), i.e. it's based on base 2, not base 10, and so on with megabytes, gigabyes, etc. This is why the number can look slightly off of what you expect.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.