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.
1. When using dd, it does not always work. Here is what I mean ->
Code:
dd if=/dev/zero of=dev/sda bs=1M count=1
What I want to do is clear the 1st megabyte of the hard drive. This would render it initialized. On Windows, the diskpart clean command erases the 1st and last megabyte of the drive. It is always initialized after that.
The dd command sometimes works sometimes it does not. What is the proper use of the command. (?Can you run the command from the host linux install on the host drive? or do I need to boot a recovery disk every time?)
2. How can I automatically use dd to erase 1st mb and last mb in one call? like diskpart clean. Can someone write a quick script and show how to call it.
1. When using dd, it does not always work. Here is what I mean ->
Can you clarify your question...
copy/paste the output of your command to see what actually happens.
Quote:
Originally Posted by turtlemicro
2. How can I automatically use dd to erase 1st mb and last mb in one call? like diskpart clean. Can someone write a quick script and show how to call it.
When the command will work using a terminal we can then write a script.
The problem is, there is no error message. Since sometimes it works, the command is always run. When it does not work, after rebooting the OS, the OS still boots because it's there. Please excuse me, this might be silly anyway.
In Windows, the OS does not allow you to format the C:\ drive. In Linux, the OS allows you to run dd and sometimes it deletes the 1st mb. I understand it's possible that the operation of the system, protects certain areas of the drive, and so on. Too complicated for me to pursue, but since it works sometimes, I wanted to know what I was doing right or wrong. I am still interested in a script if you have one (bash?).
Also, if you have a specific sequence to initialize a drive, please let me know the best way to do it in Linux.
Last edited by turtlemicro; 11-04-2011 at 03:04 AM.
There is a (huge) thread here on "dd".
I find it unlikely it "sometimes" works - unless you have some "anti-virus protection" (say in the BIOS) that gets in the way.
The second MBR copy at the end of the disk is a M$oft "feature" - shouldn't affect you if you only boot Linux.
I've had no issues doing similar to you - even with Windoze on the same system/disk.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.