kosakgroove Posted December 7, 2016 Share Posted December 7, 2016 More info at: http://www.thegroovykosak.blogspot.pt Here is a video I made demonstrating the procedure. https://www.youtube.com/watch?v=04SLD2Kft60 Download your distro of choice, in my case Ubuntu Gnome edition Once that is done, use the command that follows to convert the iso to img: hdiutil convert -format UDRW ~/path/to/target.iso -o ~/path/to/ubuntu.img Note: OS X tends to put the .dmg ending on the output file automatically, delete the ".dmg" ending. Run diskutil list to get the current list of devices Insert your flash media Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2) Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, Nwould be 2) Execute the following command while replacing /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg). sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m Using /dev/rdisk instead of /dev/disk may be faster. Run diskutil eject /dev/diskN and remove your flash media when the command completes Restart your Mac and press Alt while the Mac is restarting to choose the USB-Stick or restart your PC and choose the USb from BIOS. This USB should work for any computer. Note: (If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M. If you see the error dd:/devdiskN: Resource busy, make sure the disk is not in use. Start the Disk Utility.app and unmount (don't eject) the drive. ) Thanks for watching 2 Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/ Share on other sites More sharing options...
nawcom Posted December 27, 2016 Share Posted December 27, 2016 Sorry but I've got to correct you here. Once that is done, use the command that follows to convert the iso to img: hdiutil convert -format UDRW ~/path/to/target.iso -o ~/path/to/ubuntu.img You're literally making a copy of the ISO under a different filename. That's it. run md5 ~/path/to/target.iso md5 ~/path/to/ubuntu.img and you'll see that the md5sums match. Ubuntu and many other Linux distributions switched to an isohybrid format years ago which includes syslinux MBR code that allows it to be compatible both as an ISO9660 image for being read off optical media as well as being on disk storage devices. They've also added UEFI compatibility so you can boot it on either a legacy BIOS system or UEFI. That's why all that's needed is a simple: sudo dd if=path/to/file.iso of=/dev/rdiskX bs=1m and it's ready to boot. Read: http://www.syslinux.org/wiki/index.php?title=Isohybrid 5 Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2339987 Share on other sites More sharing options...
liujianwei Posted December 31, 2016 Share Posted December 31, 2016 Sorry but I've got to correct you here. You're literally making a copy of the ISO under a different filename. That's it. run md5 ~/path/to/target.iso md5 ~/path/to/ubuntu.img and you'll see that the md5sums match. Ubuntu and many other Linux distributions switched to an isohybrid format years ago which includes syslinux MBR code that allows it to be compatible both as an ISO9660 image for being read off optical media as well as being on disk storage devices. They've also added UEFI compatibility so you can boot it on either a legacy BIOS system or UEFI. That's why all that's needed is a simple: sudo dd if=path/to/file.iso of=/dev/rdiskX bs=1m and it's ready to boot. Read: http://www.syslinux.org/wiki/index.php?title=Isohybrid can i use reverse purpose? sudo dd if=/dev/rdiskX of=path/to/file.iso bs=1m Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2341829 Share on other sites More sharing options...
nawcom Posted December 31, 2016 Share Posted December 31, 2016 can i use reverse purpose? sudo dd if=/dev/rdiskX of=path/to/file.iso bs=1m If you're referring to just any disk that had a standard disk partition table, you could do that as well but just because you dded rdiskX to a filename with a .iso extension doesn't mean it's a legit ISO file for optical media. If you burn it to a DVD it won't be readable. All you're doing is creating a file image of your whole hard disk, so I'd suggest to use something like .img as the file extension just so you can distinguish the difference. Anyways, the resulting file would be mountable in Disk Utility in OS X (whether you named it .img or .iso, Disk Utility doesn't care) and Disk Utility would detect the multiple partitions if you had more than one. If you wanted to mount that disk image in something like Linux you would need to use a program like kpartx that helps you identify the offsets of the partitions inside that disk image. I believe the "losetup" command has similar support for scanning for partitions too now. 1 Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2342040 Share on other sites More sharing options...
liujianwei Posted December 31, 2016 Share Posted December 31, 2016 If you're referring to just any disk that had a standard disk partition table, you could do that as well but just because you dded rdiskX to a filename with a .iso extension doesn't mean it's a legit ISO file for optical media. If you burn it to a DVD it won't be readable. All you're doing is creating a file image of your whole hard disk, so I'd suggest to use something like .img as the file extension just so you can distinguish the difference. Anyways, the resulting file would be mountable in Disk Utility in OS X (whether you named it .img or .iso, Disk Utility doesn't care) and Disk Utility would detect the multiple partitions if you had more than one. If you wanted to mount that disk image in something like Linux you would need to use a program like kpartx that helps you identify the offsets of the partitions inside that disk image. I believe the "losetup" command has similar support for scanning for partitions too now. if I have 8GB USB Flash Drive that have 5GB Sierra Installer data that have MBR,what is the command to back up all data to dmg at most small size so I can send it via IM to another people to let him make a 1:1 same USB Flash Drive?Pleas help it it annoy me so many years. Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2342078 Share on other sites More sharing options...
kosakgroove Posted January 1, 2017 Author Share Posted January 1, 2017 if I have 8GB USB Flash Drive that have 5GB Sierra Installer data that have MBR,what is the command to back up all data to dmg at most small size so I can send it via IM to another people to let him make a 1:1 same USB Flash Drive?Pleas help it it annoy me so many years. Best way is through Mac OS X Disk Utility, creating a new image from your flash drive. Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2342297 Share on other sites More sharing options...
nawcom Posted January 2, 2017 Share Posted January 2, 2017 Best way is through Mac OS X Disk Utility, creating a new image from your flash drive.Yes, but it still requires a few more steps in order for that DMG to be bootable after you image it to another flash drive due to certain limitations, especially with BIOS MBR compatibility. if I have 8GB USB Flash Drive that have 5GB Sierra Installer data that have MBR,what is the command to back up all data to dmg at most small size so I can send it via IM to another people to let him make a 1:1 same USB Flash Drive?Pleas help it it annoy me so many years. Even if you were able to make a 1:1 8GB raw disk image to dd to another 8GB flash drive, you can't really compress the resulting image to a size comparable to how small Disk Utility can shrink their DMGs even though you're only using 5GB of data on it - I've actually tried myself just for the fun of it. Going the DMG route is the best way and unfortunately just creating a DMG in Disk Utility isn't enough to make it MBR bootable - it requires a few more steps. I was in the mood to write a how-to guide tonight for some reason, so If you wanna know how, feel free to read this. And you want commands? I'll give you the commands if you're curious, but if it's too much then just ignore them and go with the point-and-click way of getting this done. Let's start with just creating the bootable USB itself (which it looks like you already have done), then I'll show you how to make a DMG image of it, and then how to correctly image that back onto another USB flash drive and make that one bootable. Making the USB Media This may not be new to you: I follow the createinstallmedia technique of making the USB media - using that technique uses less space than using the previous BaseSystem.dmg imaging technique, so use it if you aren't installing on an AMD system where you have to replace the kernel. Note that even though they show you to use GUID partition table in the Disk Utility pic, using Master Boot Record is just fine. After I install Clover to it Legacy style for MBR booting as shown in the guide, I put my kexts and my Clover config.plist into their correct place in the EFI folder. Then I make a copy of the Clover install pkg file and put it on there, so you can use it after you install the OS as well as when you or someone else plans on imaging this DMG you're creating onto another USB. Unfortunately some of the boot media doesn't get saved in it which I will point out later, which is where that Clover pkg will come into use. This is what it looks like: Making the DMG You open up Disk Utility and right click on the "Install macOS Sierra" partition, not the disk, and select "Image from": And then save it where you prefer: It doesn't matter if you select read-only, read-write, or compressed. When you image it back to USB it will have read/write access anyways, and due to the packages on it being already compressed enough, you can't really shrink the size of the resulting DMG file by much more. Feel free to if you want to though. Since you mention command line stuff - this is how to do the same thing from command line if you're curious (using the same file names and locations in the pics): sudo diskutil unmount /dev/disk1s1 && sudo hdiutil create ~/Install\ macOS\ Sierra.dmg -srcdevice /dev/disk1s1 Why do I only image the partition instead of the whole USB disk? Because Disk Utility has issues restoring that DMG that represents the whole disk and will report an error when you attempt to write it to a flash drive, so this is the more effective way of doing it. Once completed, you have your resulting DMG file: There's your DMG ready to use later. Imaging that DMG to Another USB Flash Drive and Making it Bootable Now one thing to understand is when Disk Utility (and other apps like Carbon Copy Cloner) creates the DMG it doesn't include the first kilobyte of the HFS+ partition as it's a reserved spot that's usually all zeros. Clover uses that kilobyte to store the boot1h2 code which is required in order to load Clover when legacy booting. So when you restore the DMG to a USB disk later, it will be missing that as well as the MBR block code (boot0af or boot0ss) which is where reinstalling Clover comes into play. You can also reinstall those 2 files from command line instead which I'll share with you as well at the bottom of this how-to. boot0af? boot0ss? What's the difference?? To keep it short, boot0af works like your typical DOS MBR boot code where it boots the partition that's flagged active on your disk. Only one partition can be flagged active at a time. boot0ss is different in that it will ignore whichever partition is active and boot the partition that Clover is installed to. Most people use boot0af without issues, as the Clover pkg flags your HFS+ partition as the active partition when it gets installed. Now it's time to restore the DMG to the "other" USB flash drive. Image it to the flash drive's existing partition (doesn't matter what kind file system is there, it's going to be HFS+ now hahahaha!) through Disk Utility. Remember, restore to the partition, not the whole disk! Or from command line if you want (example has DMG in home folder and USB is /dev/disk1): sudo asr restore --source ~/Install\ macOS\ Sierra.dmg --target /dev/disk1s1 --erase --noverifyOnce it's done, open up the USB disk and run the Clover pkg that's inside so you can fix the bootloader. Then after targeting the USB drive to install Clover to, the pkg should remember all the settings and won't erase your existing config.plist, kexts, etc but it MAY have Don't update MBR and PBR sectors selected - you need to switch that to Install boot0af in MBR or Install boot0ss in MBR in order to install that boot1h2 code and MBR block code onto the USB. Go ahead and complete the Clover install. Curious how to do the same thing from command line? Here's how you do it from Terminal yourself, assuming the flash drive is /dev/disk1 with volume name "Install macOS Sierra" on the first partition: sudo fdisk -y -u -f /Volumes/Install\ macOS\ Sierra/usr/standalone/i386/boot0af /dev/disk1 sudo dd if=/Volumes/Install\ macOS\ Sierra/usr/standalone/i386/boot1h2 of=/dev/rdisk1s1 note: this part won't be needed if you used boot0ss instead of boot0af: sudo fdisk -e /dev/disk1 fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory Enter 'help' for information fdisk: 1> f 1 Partition 1 marked active. fdisk:*1> w Device could not be accessed exclusively. A reboot will be needed for changes to take effect. OK? [n] y Writing MBR at offset 0. fdisk: 1> q There you go - you imaged that DMG to a flash drive and it's ready to boot up on a BIOS (or UEFI in legacy mode) PC. Unfortunately it's not a simple dd command as you probably wished but it's how you get the job done Also since this can be done from command line, you could just write a script that you double click on and it will automate the imaging of the DMG to USB flash drive and re-installation of the Clover boot files for you, so you have many possibilities. And on a side note - some people may suggest using something like Carbon Copy Cloner instead of Disk Utility. You will still have to reinstall boot0af and boot1h2 manually or via the Clover pkg so you won't be getting any shortcuts by using it instead. 1 Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2342541 Share on other sites More sharing options...
liujianwei Posted January 2, 2017 Share Posted January 2, 2017 thank you so much,but could i have another method that use win32 disk imager to write img file that create by any possible method just like niresh mavericks to usb flash drive in easy way because another person only using bios based pc that run windows 7 and he want one click 1:1 copy to any size of usb flash drive that bigger than 4GB. Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2342825 Share on other sites More sharing options...
liujianwei Posted January 7, 2017 Share Posted January 7, 2017 how about this open '/Users/cuthead/Downloads/InstallESD.dmg' open '/Volumes/Mac OS X Install ESD/BaseSystem.dmg' open diskutil,click restore,source select Mac OS X Base System,destination select Untitled rm '/Volumes/Mac OS X Base System 1/System/Installation/Packages' cp -R '/Volumes/Mac OS X Install ESD/Packages' '/Volumes/Mac OS X Base System 1/System/Installation/' cp '/Volumes/Mac OS X Install ESD/mach_kernel' '/Volumes/Mac OS X Base System 1/' Install for UEFI booting only Install Clover in the ESP Drivers64UEFI OsxAptioFixDrv-64 cp -R '/Users/cuthead/Downloads/FakeSMC.kext' '/Volumes/EFI/EFI/CLOVER/kexts/10.7' cp -R '/Users/cuthead/Downloads/RealtekR1000SL.kext' '/Volumes/EFI/EFI/CLOVER/kexts/10.7' 1 Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2345972 Share on other sites More sharing options...
liujianwei Posted January 12, 2017 Share Posted January 12, 2017 this solved my problem diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://10000000` Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2348088 Share on other sites More sharing options...
kosakgroove Posted January 24, 2017 Author Share Posted January 24, 2017 Sorry but I've got to correct you here. You're literally making a copy of the ISO under a different filename. That's it. run md5 ~/path/to/target.iso md5 ~/path/to/ubuntu.img and you'll see that the md5sums match. Ubuntu and many other Linux distributions switched to an isohybrid format years ago which includes syslinux MBR code that allows it to be compatible both as an ISO9660 image for being read off optical media as well as being on disk storage devices. They've also added UEFI compatibility so you can boot it on either a legacy BIOS system or UEFI. That's why all that's needed is a simple: sudo dd if=path/to/file.iso of=/dev/rdiskX bs=1m and it's ready to boot. Read: http://www.syslinux.org/wiki/index.php?title=Isohybrid Thanks Master! Had no idea how easy it was And had never heard about the changes Linux distros had made these years, since I have been dedicating myself more deeply to Hackintosh (only running Linux in virtual machines) Link to comment https://www.insanelymac.com/forum/topic/319016-guide-make-linux-usb-from-mac-os-x-from-terminal/#findComment-2356070 Share on other sites More sharing options...
Recommended Posts