ManyBeers Posted September 11, 2008 Share Posted September 11, 2008 I recently installed Ubuntu 8.04 on my Sony laptop Which already had WindowsXP on C:\drive(ntfs) and another D:\drive(fat32) which will be shared between the two systems. When I installed Linux I created a swap and /ext3 for Ubuntu.All partitions are primary so my partitions are no. sda1,sda2,sda3, and sda4. Anyways Grub is my current bootloade(installed in MBR) and works fine. However I would prefer to use Windows bootloader for my reasons.To do so I need to make a copy of Grubs stage i boot files. So after mounting my fat32 partition which is called "fatty" I opened a terminal and in it I typed: sudo dd if=/dev/sda of=/dev/fatty/ubuntu.bin bs=446 count=1 after prompting for my password which i supplied I go ta" permission denied" dialog. Was this because I am not allowed access to the file or because Ubuntu is running and the file is in use? Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 (edited) Well, I cannot think of a single reason to use the Windows boot loader over GRUB. If you need to troubleshoot boot issues, GRUB allows you to interrupt, probe drives and check for kernel images to pick one and boot with a nearly infinite number of options to pass in the event it is needed. Windows boot loader.... Ummm... Boots one or the other. No ability to drop into a command mode and do anything manually. As for what is going on, your "output file" is not correct. There is no "/dev/fatty/" There is "/dev/sda0" and there is probably "/mnt/fatty" (possibly /media/fatty or such). You mixed up your devices with your mount point in that command. ;) EDIT: P.S. You might want to use more descriptive thread titles than "help". Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 (edited) Well, I cannot think of a single reason to use the Windows boot loader over GRUB. If you need to troubleshoot boot issues, GRUB allows you to interrupt, probe drives and check for kernel images to pick one and boot with a nearly infinite number of options to pass in the event it is needed.Windows boot loader.... Ummm... Boots one or the other. No ability to drop into a command mode and do anything manually. As for what is going on, your "output file" is not correct. There is no "/dev/fatty/" There is "/dev/sda0" and there is probably "/mnt/fatty" (possibly /media/fatty or such). You mixed up your devices with your mount point in that command. ;) EDIT: P.S. You might want to use more descriptive thread titles than "help". So I can do what I want to from within Ubuntu ? Fatty is the name I gave to my Fat32 shared partition. Just a naming convention. On my Ubuntu desktop when I right click and mount the device it says Fatty. Fine then would you write a proper dd command for me ? Her is my setup: 20 gb toshiba harddrive 4 partitions ..1st 6.5 gb C:\drive(ntfs, WindiwsXP primary) 2nd 6.0gb D:\drive(fat32apps,shared primary) 3rd 630mb Linux swap(primary 4th 5gb ext3 /Linux. drives are sda designation sda1 sda2 sda3 sda4. I need to dd the master boot record of the drive bs of 446 and send it to sda2. The 446 is Grub's ipl, I don't want thr full 512 length which includes the partition map or whatever it is. Edited September 12, 2008 by ManyBeers Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 Before I give you a command that is potentially disruptive, can I get the output of two commands? mount sudo fdisk -l (that is a lowercase letter "L", not the number one) This will tell me exactly what partitions you have existing, and what mount points you connected them to. Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 Before I give you a command that is potentially disruptive, can I get the output of two commands?mount sudo fdisk -l (that is a lowercase letter "L", not the number one) This will tell me exactly what partitions you have existing, and what mount points you connected them to. Yes, However I am in Windows right now bu will be back on Ubuntu in 5 minutes. Link to comment Share on other sites More sharing options...
Fred Derf Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 [Thread Title Edited] Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 Before I give you a command that is potentially disruptive, can I get the output of two commands?mount sudo fdisk -l (that is a lowercase letter "L", not the number one) This will tell me exactly what partitions you have existing, and what mount points you connected them to. Here is fdisk mark@ubuntu:~$ sudo fdisk -l [sudo] password for mark: Disk /dev/sda: 20.0 GB, 20003880960 bytes 255 heads, 63 sectors/track, 2432 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa5b0292e Device Boot Start End Blocks Id System /dev/sda1 1 853 6851691 7 HPFS/NTFS /dev/sda2 854 1682 6658942+ c W95 FAT32 (LBA) /dev/sda3 1683 1757 602437+ 82 Linux swap / Solaris /dev/sda4 * 1758 2432 5421937+ 83 Linux mark@ubuntu:~$ Before I give you a command that is potentially disruptive, can I get the output of two commands?mount sudo fdisk -l (that is a lowercase letter "L", not the number one) This will tell me exactly what partitions you have existing, and what mount points you connected them to. Here is mount: /dev/sda4 on / type ext3 (rw,relatime,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) /sys on /sys type sysfs (rw,noexec,nosuid,nodev) varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755) varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777) udev on /dev type tmpfs (rw,mode=0755) devshm on /dev/shm type tmpfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) lrm on /lib/modules/2.6.24-19-generic/volatile type tmpfs (rw) securityfs on /sys/kernel/security type securityfs (rw) gvfs-fuse-daemon on /home/mark/.gvfs type fuse.gvfs-fuse-daemon (rw,nosui Link to comment Share on other sites More sharing options...
pyther Posted September 12, 2008 Share Posted September 12, 2008 What does df -h show? Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 (edited) You didn't have your NTFS or FAT partition mounted when you took that "mount" command output. I think that this will work dev to dev, so in which case the command would be either: sudo dd if=/dev/sda of=/dev/sda1/ubuntu.bin bs=446 count=1 (for your NTFS drive C) or sudo dd if=/dev/sda of=/dev/sda2/ubuntu.bin bs=446 count=1 (for your FAT drive D) EDIT: Corrected sda1 copy/paste error, and renamed file with a ".bin" extension, instead of ".in". It doesn't matter what the file is called, but ".in" isn't a very good name to have it. Edited September 12, 2008 by markjensen Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 You didn't have your NTFS or FAT partition mounted when you took that "mount" command output.I think that this will work dev to dev, so in which case the command would be either: sudo dd if=/dev/sda of=/dev/sda1/ubuntu.in bs=446 count=1 (for your NTFS drive C) or sudo dd if=/dev/sda of=/dev/sda1/ubuntu.in bs=446 count=1 (for your FAT drive D) Well I right clicked on my fat drive in Computer and selected mount and the next thing that happens is a drive named Fatty materializes on my desktop. Does that mean it is mounted? In your line of code there ..isn't sda1 the 1st partition on the drive in which case that is my Windows drive which I don't want to touch. I think both your code lines are identical. Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 :pinch: darn copy/paste. The second line should say sudo dd if=/dev/sda of=/dev/sda2/ubuntu.bin bs=446 count=1 As far as "not touching" a Windows drive... If the file needs to be written to a Windows drive to be seen, you are going to have to get it there somehow. Yeah, when you mount it and see it, then it is actually active. Think of it in the same way as when you tell Windows to connect to a network drive (since Windows tries to auto-mount every local drive it sees). Linux generally needs to be told to mount a partition (although you can tell Linux to mount that partition every time it boots, so it is automatically done for you) sda1 is your NTFS, sda2 is your FAT. Since neither were mounted when you ran the 'mount' command, neither of them showed up in the mtab (or when you typed 'mount'). What I am less clear on is if Windows will boot from your NTFS drive and allow you to point to another partition (your D: one) to read the ubuntu boot file. I do think it has to be on the same partition you booted from. Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 :pinch: darn copy/paste. The second line should say sudo dd if=/dev/sda of=/dev/sda2/ubuntu.bin bs=446 count=1 As far as "not touching" a Windows drive... If the file needs to be written to a Windows drive to be seen, you are going to have to get it there somehow. Yeah, when you mount it and see it, then it is actually active. Think of it in the same way as when you tell Windows to connect to a network drive (since Windows tries to auto-mount every local drive it sees). Linux generally needs to be told to mount a partition (although you can tell Linux to mount that partition every time it boots, so it is automatically done for you) sda1 is your NTFS, sda2 is your FAT. Since neither were mounted when you ran the 'mount' command, neither of them showed up in the mtab (or when you typed 'mount'). What I am less clear on is if Windows will boot from your NTFS drive and allow you to point to another partition (your D: one) to read the ubuntu boot file. I do think it has to be on the same partition you booted from. I read and write to my D;\drive all the time. I have programs installed on it and use them regularly. I have an ext3 program for XP that allows me to read and write to Linux partitions. In fact in my Windows explorer they are labeled L;and S: Link Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 I never said Windows can't use D drive. Just that when it is in the very first stage of booting, that it only has mounted the one boot partition. It hasn't mounted "D", so you can't point to files there. Are you sure that you are making this easier on yourself? :unsure: Link to comment Share on other sites More sharing options...
Fred Derf Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 What markjensen is saying is that, while the full Linux OS can write to your D: drive, the GRUB boot manager will likely not be able to read files from a drive that has not yet been mounted. GRUB occurs before the rest of Linux has fully loaded. Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 I never said Windows can't use D drive. Just that when it is in the very first stage of booting, that it only has mounted the one boot partition. It hasn't mounted "D", so you can't point to files there.Are you sure that you are making this easier on yourself? :unsure: I may not even go through with it, but I would still like the option of being able to. About the code.. In your opinion when I get the Permission Denied Error in Ubuntu when trying to dd the file that ha snothing to do with the fact that Ubuntu is running. Is that right? Because a couple of articles I read the authors used Systenm Rescue cd to access the Ubuntu partition to runn dd. I have a SR cd but don't know how to mount and unmount drives using it. Otherwise I would do it taht way becaise i know it works. Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 When you got that "permission denied" error, that was your first post. And I have already told you that your command was messed up, telling it your "mount" name in your "/dev/" directory. Mount names are in your mount directory, and device names are in your /dev. There is no mixing. Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 When you got that "permission denied" error, that was your first post. And I have already told you that your command was messed up, telling it your "mount" name in your "/dev/" directory. Mount names are in your mount directory, and device names are in your /dev. There is no mixing. So if I mount sda2(fatty) I would use this code: sudo dd if=/dev/sda of=/dev/sda2/ubuntu.bin bs=446 count=1 Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted September 12, 2008 Veteran Share Posted September 12, 2008 Yes. sudo = root power dd = data dump if = input file (device) /dev/sda = first hard drive, starting at sector 0 or MBR of = output file (device) /dev/sda2/ = second partition, in this case your FAT "D:" drive ubuntu.bin = the target destination file for this data bs=446 = block size of 446 bytes count=1 = just do this one iteration, don't continue That will put the GRUB MBR you currently have into your "D:" drive. You may have to muck with your "multi(0)disk(0)rdisk(0)partition(1)" information in your new Linux entry you create. It may be possible to specify an entry like D:\ubuntu.bin="Ubuntu" and it might work. It might not, if D: is not recognized by the Windows boot loader. If not, move the file into your C: drive and change your boot.ini to point to C:\ubuntu.bin Best of luck! Link to comment Share on other sites More sharing options...
ManyBeers Posted September 12, 2008 Author Share Posted September 12, 2008 Yes.sudo = root power dd = data dump if = input file (device) /dev/sda = first hard drive, starting at sector 0 or MBR of = output file (device) /dev/sda2/ = second partition, in this case your FAT "D:" drive ubuntu.bin = the target destination file for this data bs=446 = block size of 446 bytes count=1 = just do this one iteration, don't continue That will put the GRUB MBR you currently have into your "D:" drive. You may have to muck with your "multi(0)disk(0)rdisk(0)partition(1)" information in your new Linux entry you create. It may be possible to specify an entry like D:\ubuntu.bin="Ubuntu" and it might work. It might not, if D: is not recognized by the Windows boot loader. If not, move the file into your C: drive and change your boot.ini to point to C:\ubuntu.bin Best of luck! Thanks Mark. I will be moving the file to my C:\ first thijng and then modifying my boot.ini. The tutorrials I have read the file is always moved to C: Link to comment Share on other sites More sharing options...
ManyBeers Posted September 13, 2008 Author Share Posted September 13, 2008 Final post: Well I tried everything I could think of to dd the master boot record file from within Ubuntu(while it is running) and for me it was not possible. So I booted up the System Rescue cd and after some frustration I finally figured out how to mount a drive(1st time i have ever done that) using Terminal in the Graphic environment offered on SRCD. I was able to copy the file to where Windows could access it, moved it to the root of C: modified my boot.ini to point to that file(which is Grub's stage_1)and everything worked fine,except for one thing-my laptop's BIOS does not support LBA(Logical Block Addressing) so Linux could not boot because it is installed well outside LBA limit of 8.5gbs. At least I am pretty sure that is the problem. When I selected Linux in my boot menu it simply reverted back to the boot menu. Oh well. Link to comment Share on other sites More sharing options...
redvamp128 Posted September 16, 2008 Share Posted September 16, 2008 I wish I still had the file but there is a grub4dos which I ran to boot to puppy linux--using the Boot.ini.... It had one file grldr then a menu.1st on the primary drive... https://sourceforge.net/projects/grub4dos http://grub4dos.sourceforge.net/ http://www.gnu.org/software/grub/manual/grub.html It worked for me--- all I had to do was create a link to that file on my c:\ then menu.1st did the rest... Found better guide with links but check this one out--- http://www.murga-linux.com/puppy/viewtopic.php?t=2276 Link to comment Share on other sites More sharing options...
ManyBeers Posted September 16, 2008 Author Share Posted September 16, 2008 I wish I still had the file but there is a grub4dos which I ran to boot to puppy linux--using the Boot.ini.... It had one file grldr then a menu.1st on the primary drive...https://sourceforge.net/projects/grub4dos http://grub4dos.sourceforge.net/ http://www.gnu.org/software/grub/manual/grub.html It worked for me--- all I had to do was create a link to that file on my c:\ then menu.1st did the rest... Found better guide with links but check this one out--- http://www.murga-linux.com/puppy/viewtopic.php?t=2276 Well I am not going to change anything now as my computer boots fine using Grub. In fact Grub is a bit more flexible than Windows ntldr. The thing is before I installed Ubuntu I had read about the LBA limitations and new I needed to mount Ubuntu on my second partition which is only 6.5 gbs in on the drive, just in case my Sony's BIOS didn't support LBA. But when I finally installed Ubuntu several days later I forgot about it and made a fat32 shared drive there instead . I now have programs and what not installed on there so it will stay the way it is. It was a good learning experience for me. Link to comment Share on other sites More sharing options...
Recommended Posts