Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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 playing around with Linux distros that will run from a USB memory stick and will finction as a complete OS, as if running from an HDD. One that I tried installed the bootloader to the stick's MBR. I have since formatted the stick, so the OS is gone, but the bootloader is still there pointing to it.
I need to get rid of the MBR bootloader so that when my laptop boots to the USB stick, the syslinux file points it to the right OS. How do I clear the MBR?
You can re-install the MBR onto the USB Stick with syslinux, for a stick connected as /dev/sda the following will reinstall the MBR, adjust the device name to suit your setup.
OK, I ran that command to clear the MBR, but it seems that when it did, it also removed all partition s from the memory stick as well. How do I put a partition on there from the command line?
That was a poor decision. Not knowing syslinux, I would have thought the solution offered by madluther would be the best place to start.
What the dd command actually did was also remove the partition table; although the data in the partitions hasn't been touched.
Not only that, it removed the signature bytes on the disk - which means fdisk and cfdisk won't open the disk. These two utilities are the normal way to create partitions.
testdisk probably will do the job although I haven't looked at the code - maybe parted as well.
Probably gparted as well, if you have a GUI available.
oneandoneis2, I suggest you not offer this advice to anyone else.
spiffytech: As syg00 pointed out, the parted rescue feature usually does a good job of recovering primary partitions. How to use the rescue option is explained here: http://www.gnu.org/software/parted/m...ted.html#SEC24
..........
Regarding the “dd” command:
Once upon a time, a salesman locked himself out of his car in Manhattan. A kid walked up and said “Hey mister, I’ll open your car for $10, but I want the money up front.” So the salesman gave him $10 and the kid picked up a brick and broke the side window. “Hey mister, you didn’t ask me how I was going to do it.”
The OP says the drive has been formatted, implying there was no valuable data on the drive, or I wouldn't have recommended the dd method.
I've never had any problems repartitioning a flash drive that's been dd'd in the manner I mentioned. I forget if I used fdisk or cfdisk, but those are the only partitioners I have installed, so I know for a fact that at least one of them works just fine.
Under the cirumstances, as a simple way of clearing the MBR of a blank disk, I believe the dd method is a good one.
I just had the opportunity to zero a hard-disk prior to the laptop being returned to the leasing company.
fdisk opened and created partitions even with the zero'd MBR just fine.
Didn't work the last time I tried it, did with this version of Knoppix (3.9 - kernel 2.6.11).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.