1. Using fdisk, I created two partitions on the drive: /dev/sdc1 = 15 MB /dev/sdc2 = The rest I marked the first one bootable 注: [root@localhost wini]# fdisk -l Disk /dev/hda: 120.0 GB, 120034123776 bytes ...(输出信息略) Disk /dev/sda: 4173 MB, 4173332480 bytes ....(输出信息略) [root@localhost wini]# [root@localhost wini]# fdisk /dev/sda Command (m for help): p Disk /dev/sda: 4173 MB, 4173332480 bytes 255 heads, 63 sectors/track, 507 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 507 4072446 b W95 FAT32 Command (m for help): d Selected partition 1 Command (m for help): 1 1: unknown command Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): p Disk /dev/sda: 4173 MB, 4173332480 bytes 255 heads, 63 sectors/track, 507 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-507, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-507, default 507): 15M Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (16-507, default 16): Using default value 16 Last cylinder or +size or +sizeM or +sizeK (16-507, default 507): Using default value 507 Command (m for help): a Partition number (1-4): 1 Command (m for help): p Disk /dev/sda: 4173 MB, 4173332480 bytes 255 heads, 63 sectors/track, 507 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 15 120456 83 Linux /dev/sda2 16 507 3951990 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 设备或资源忙. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. [root@localhost wini]# fdisk -l /dev/sda Disk /dev/sda: 4173 MB, 4173332480 bytes 255 heads, 63 sectors/track, 507 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 15 120456 83 Linux /dev/sda2 16 507 3951990 83 Linux 2. I used dd to copy the diskboot.img to /dev/sdc1 [root@localhost wini]# mount /mnt/temp/centos54/CentOS-5.4-i386-bin-DVD.iso /mnt/wini/ -o loop [root@localhost wini]# cd /mnt/wini/ [root@localhost wini]# dd if=images/diskboot.img of=/dev/sda1 24576+0 records in 24576+0 records out 12582912 bytes (13 MB) copied, 6.0851 seconds, 2.1 MB/s 3. Formatted /dev/sdc2 as ext3(我使用了FAT32) and copied the iso images there [root@localhost wini]# mkfs.vfat /dev/sda 4. When I boot from the usb drive, I selected hard drive install and pointed the installer to /dev/sdc2 It worked perfectly! Thanks, Neil
The aim of this post is to explain how to install Fedora directlyfrom a USB stick containing the Fedora*-DVD.iso image. For thoseimpatient, just go to the Instructions section.
It’s been almost 2 years since I said goodbye to Windows and movedmy work laptop to Fedora, and I couldn’t be happier with the move. Ifyou wanna find out why I’m happier with Fedora, just carry on readingmy blog over the coming months. For the moment, I’ll be focusing on theFedora installation process. One of the best things about Fedora isthat it gets released twice a year so you keep upgrading your machineto the get the latest features, latest bugs…etc. This means that youend up downloading and burning a Fedora ISO into a brand new DVD every6 months. As you can imagine, I was quickly piling up DVDs that wereuseless soon after. So, after having looking around in electronicshops, I realised that USB keys had gone down in price and that youcould get an 8GB USB stick for little money. This happened at the sametime that I was getting a new laptop at work, so I wondered, what aboutI get myself one of those sticks, put the latest Fedora image on it andinstall it from there rather than burning yet another DVD? For sure,installing from an USB key was always going to be faster than from aDVD, so that was a plus as well.
For some reason, maybe because people haven’t tried this that much,it took me a while to find some decent instructions on how to do this.Eventually, this came from Michale Hartley’s comment on Haral Hoyer’s blog entry on “Fedora 8 on a USB stick”.However, I had some issues with these instructions, specially whentrying to create the bootable partition in the USB stick, so I ended upwriting my own set of instructions for Fedora 9:
1 |
livecd-iso-to-disk Fedora-9-i386-netinst.iso /dev/sdb1 |
1 2 3 |
mount /dev/sdb2 mnt-sdb2/ cp Fedora-9-i386-DVD.iso mnt-sdb2/ umount mnt-sdb2/ |
When Fedora 10 was released, I followed the same steps to install asI did for Fedora 9 but I kept getting an error saying that no imagecould be found in /dev/sdb2 even though the Fedora 10 DVD isoimage was there and had passed the SHA1SUM test successfully. Afterexchanging some emails within Red Hat I was pointed to the Installation from a Hard Drive section of the Fedora 10 documentation, which mentioned that install.img had to be present under the images/ directory in the partition from where Fedora 10 had to be installed.
On my 2nd attempt, I extracted the entire DVD iso and put it in the USB stick so that images/install.img would be found but doing only that didn’t work. In the 2nd phase of theinstallation, I was told that an image was missing. I just couldn’tunderstand what the hell was going on, so eventually, after a fewfurther email exchanges, I worked out what needed doing: First, images/install.img had to be in the USB stick and next to the images/ folder, you needed to have Fedora-10-i386-DVD.iso. So, here’re the instructions to install Fedora 10 from USB stick:
1 |
livecd-iso-to-disk Fedora-10-i386-netinst.iso /dev/sdb1 |
1 2 3 4 |
mount -t iso9660 Fedora-10-i386-DVD.iso mnt-dvd/ -o loop mount /dev/sdb2 mnt-sdb2/ cp -rp mnt-dvd/images mnt-sdb2/ umount mnt-dvd/ |
Note: If you do a ‘cp -a’ as recommended in the Installing from Hard Drive section, you’ll get an error like this, so just use ‘cp -rp’ instead:
SELinux is preventing cp from creating a file with a context ofiso9660_t on a filesystem. Usually this happens when you ask the cpcommand to maintain the context of a file when copying between filesystems, “cp -a” for example. Not all file contexts should bemaintained between the file systems. For example, a read-only file typelike iso9660_t should not be placed on a r/w system. “cp -P” might be abetter solution, as this will adopt the default file context for thedestination. .
1 2 |
cp Fedora-10-i386-DVD.iso mnt-sdb2/ umount mnt-sdb2/ |
And that’s it. I’m fully aware that these instructions could besimplified/reduced but can’t be bothered to do that right now. It’s notsomething that I’m doing on a daily basis and it works, so I’m happy toleave them as they are for the time being. If anyone has anysuggestions, please feel free to comment.