热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CentOSISOtoUSBonMacOSX

WindowsusershaveagreatfreetoolcalledISO2USBwhichefficientlytransfersISOimagestoaUSBstick.M

Windows users have a great free tool called ISO2USB which efficiently transfers ISO images to a USB stick. Mac users don’t have such a luxury – at least I haven’t found one yet.

Instead we can make use of a command line tool named dd which can do this for us. It needs a few parameters though, and in this article we’ll look at what those are. The following will work in both Mavericks and Yosemite, with ISOs from CentOS 6.5 and above. Our operation will result in a bootable USB stick.

First, head over to a CentOS Mirror and download your favourite ISO image. Next, have a USB stick handy and insert it into your Mac. Now open Terminal – it’s under Applications – Utilities, or do a Spotlight search to find it.

For this example I’m assuming that the image file is called centos.iso and that it’s in your Downloads directory. Let’s enter that directory by issuing the following command:

cd ~/Downloads
ls

The second command lists all files, and your ISO image should be one of them.


Find out what device your USB stick is

So far so good, we’re in the right location. The dd command needs to know which file you want to copy (see above), and the device corresponding to your USB stick. It’s easy to get confused at this point. Let me explain this:

Devices are things attached to the system, such as hard disk, memory cards and USB sticks. Each device can hold a number of partitions which is where your data is stored. Depending on how many storage devices are attached to your system, you’ll get a specific address for each device. For example, /dev/disk0 is your internal Mac hard disk in which you’ll find three partitions.

Since our ISO image will overwrite all partitions on the USB stick, we need to know what the system knows our USB stick as. Type the following to get a list of what’s attached where:

diskutil list/dev/disk0#: TYPE NAME SIZE IDENTIFIER0: GUID_partition_scheme *1.0 TB disk01: EFI EFI 209.7 MB disk0s12: Apple_HFS Macintosh HD 999.3 GB disk0s23: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1#: TYPE NAME SIZE IDENTIFIER0: GUID_partition_scheme *512.1 GB disk11: EFI EFI 209.7 MB disk1s12: Apple_HFS Macintosh SSD 511.3 GB disk1s23: Apple_Boot Recovery HD 650.0 MB disk1s3
/dev/disk2#: TYPE NAME SIZE IDENTIFIER0: FDisk_partition_scheme *1.0 TB disk21: Apple_HFS VM Drive 1.0 TB disk2s1
/dev/disk3#: TYPE NAME SIZE IDENTIFIER0: GUID_partition_scheme *1.5 TB disk31: EFI EFI 209.7 MB disk3s12: Apple_HFS Black Time Machine 1.5 TB disk3s2
/dev/disk4#: TYPE NAME SIZE IDENTIFIER0: FDisk_partition_scheme *4.0 GB disk41: DOS_FAT_32 C64

Looks like I’ve got 5 storage devices on my system. The one at the bottom is my USB stick, an old 4GB model currently formatted with FAT32. Your layout will be different, so keep an eye on the SIZE parameter. If your currently formatted stick is named you can identify it that way too (mine is called C64).

The device I want to use here is /dev/disk4. Note that when we get to work, everything on your USB stick will be erased when we copy the ISO over. The dd command will not warn you before this happens.


Unmount your USB stick

Before we can continue we need to make sure your USB stick isn’t mounted to OS X. If it was formatted with a filesystem that your Mac can read, then you’ll see your stick as an orange icon on the desktop. But since the dd command will do a low level format with a different filesystem, OS X needs to let go of our stick. If we don’t do this, you’ll get a “Resource busy” message in the next step.

To unmount your stick, type the following:

diskutil unmountDisk /dev/disk4Unmount of all volumes on disk4 was successful

That orange icon should disappear from the desktop, and you will no longer see your USB stick in the Finder either. Leave it attached though – do not eject it.


Copy the ISO image over

Now let’s give the dd command something to do. Since we’re in the correct directory already, type the following (you will be prompted for your password):

sudo dd if=centos.iso of=/dev/disk4// time passes...694272+0 records in
694272+0 records out
355467264 bytes transferred in 249.100402 secs (1427004 bytes/sec)

Amend /dev/disk4 with your own device. Feel free to specify the direct path to your image file in place of centos.iso (no wildcards I’m afraid).

This step can take a long time, during which you won’t get any feedback whatsoever. That’s normal, even though it looks like your session hangs. It’s all good. As long as you leave the Terminal window open, feel free to do other things with your Mac and leave it running.

In the above example I was copying a 190MB image and it took just over four minutes. I had an abysmally slow USB stick mind you – something to keep in mind when you want to transfer a large “everything ISO” image onto a stick from 10 years ago: you’re not doing yourself a favour, it’ll take hours to copy, and just as long to boot from later.

Should you want to terminate your dd session during this time (and use a faster USB stick for example), simply hit CTRL+C and you’ll be returned to the command line.

If all went well you’ll receive a summary message at the end. Now you’re ready to boot from your stick into the wonderful world of CentOS.


推荐阅读
  • 本文详细介绍了如何在预装Ubuntu系统的笔记本电脑上安装Windows 7。针对没有光驱的情况,提供了通过USB安装的具体方法,并解决了分区、驱动器无法识别等问题。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • 本文深入探讨了二叉搜索树(Binary Search Tree, BST)及其操作,包括查找、插入和删除节点。同时,文章还介绍了平衡二叉树(AVL树)的概念及调整方法,并详细讨论了如何判断两个序列是否构成相同的二叉搜索树。 ... [详细]
  • [论文笔记] Crowdsourcing Translation: Professional Quality from Non-Professionals (ACL, 2011)
    Time:4hoursTimespan:Apr15–May3,2012OmarZaidan,ChrisCallison-Burch:CrowdsourcingTra ... [详细]
  • Windows服务与数据库交互问题解析
    本文探讨了在Windows 10(64位)环境下开发的Windows服务,旨在定期向本地MS SQL Server (v.11)插入记录。尽管服务已成功安装并运行,但记录并未正确插入。我们将详细分析可能的原因及解决方案。 ... [详细]
  • 在 Windows 10 中,F1 至 F12 键默认设置为快捷功能键。本文将介绍几种有效方法来禁用这些快捷键,并恢复其标准功能键的作用。请注意,部分笔记本电脑的快捷键可能无法完全关闭。 ... [详细]
  • MongoDB集群配置:副本集与分片详解
    本文详细介绍了如何在MongoDB中配置副本集(Replica Sets)和分片(Sharding),并提供了具体的步骤和命令,帮助读者理解并实现高可用性和水平扩展的MongoDB集群。 ... [详细]
  • 本文探讨了 Objective-C 中的一些重要语法特性,包括 goto 语句、块(block)的使用、访问修饰符以及属性管理等。通过实例代码和详细解释,帮助开发者更好地理解和应用这些特性。 ... [详细]
  • 本文将详细介绍在Windows 7环境下,检查U盘启动盘是否制作成功的多种方法,包括通过BIOS设置和使用模拟启动工具。 ... [详细]
  • 本文由瀚高PG实验室撰写,详细介绍了如何在PostgreSQL中创建、管理和删除模式。文章涵盖了创建模式的基本命令、public模式的特性、权限设置以及通过角色对象简化操作的方法。 ... [详细]
  • 根据最新发布的《互联网人才趋势报告》,尽管大量IT从业者已转向Python开发,但随着人工智能和大数据领域的迅猛发展,仍存在巨大的人才缺口。本文将详细介绍如何使用Python编写一个简单的爬虫程序,并提供完整的代码示例。 ... [详细]
  • MySQL索引详解与优化
    本文深入探讨了MySQL中的索引机制,包括索引的基本概念、优势与劣势、分类及其实现原理,并详细介绍了索引的使用场景和优化技巧。通过具体示例,帮助读者更好地理解和应用索引以提升数据库性能。 ... [详细]
  • 深入了解 Windows 窗体中的 SplitContainer 控件
    SplitContainer 控件是 Windows 窗体中的一种复合控件,由两个可调整大小的面板和一个可移动的拆分条组成。本文将详细介绍其功能、属性以及如何通过编程方式创建复杂的用户界面。 ... [详细]
  • 在 Flutter 开发过程中,开发者经常会遇到 Widget 构造函数中的可选参数 Key。对于初学者来说,理解 Key 的作用和使用场景可能是一个挑战。本文将详细探讨 Key 的概念及其应用场景,并通过实例帮助你更好地掌握这一重要工具。 ... [详细]
  • 雨林木风 GHOST XP SP3 经典珍藏版 V2017.11
    雨林木风 GHOST XP SP3 经典珍藏版 V2017.11 ... [详细]
author-avatar
残念易_138
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有