Saturday, July 24, 2010

The 10-Step Ubuntu Boot Configuration

Creating a bootable USB thumb drive requires 10 basic steps:

1. Unmount the drive. When you plug a USB drive into the computer, Ubuntu immediately mounts it. You need to unmount it before you can partition or format it.

Use the mount command to list the current mount points and identify the USB thumb drive. Be aware that the device name will likely be different for you. In this example, the device is /dev/sda1 and the drive label is NEAL.

$ mount
/dev/hda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
varrun on /var/run type tmpfs (rw)
varlock on /var/lock type tmpfs (rw)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
devshm on /dev/shm type tmpfs (rw)
lrm on /lib/modules/2.6.15-26-686/volatile type tmpfs (rw)
/dev/sda1 on /media/NEAL type vfat (rw,nodev,quiet,umask=077)

Use the unmount command to free the device:

sudo umount /dev/sda1



2. Initialize the USB device. This is needed because previous configurations could leave residues that will interfere with future configurations. The simplestway to zero a device is to use dd. Keep in mind that large drives (even 1-GB thumb drives) may take a long time to zero. Fortunately, you usually only need to zero the first few sectors.

dd if=/dev/zero of=/dev/sda # format all of /dev/sda
dd if=/dev/zero of=/dev/sda count=2048 # format the first 2048
sectors

Use the sync command (sudo sync) to make sure that all data is written. After zeroing the device, unplug it and plug it back in. This will remove any stale device partitions. Ubuntu will not mount a blank device, but it will create a device handle for it.



3. If you are making a USB hard drive, then partition the device:

sudo fdisk /dev/sda



4. Format the partitions. If you are making a USB floppy drive, then format the base device (/dev/sda). For USB hard drives, format each of the partitions (/dev/sda1, /dev/sda2, etc.).



5. Mount the partition.



6. Copy files to the partition.



7. Place the kernel and boot files on the partition.



8. Configure the boot menus and options.



9. Use the sync command (sudo sync) to make sure that all data is written and then unmount the partition.



10. Install the boot manager.


Now the device should be bootable. The next few sections show different ways to do these 10 steps.

Source of Information : Wiley Ubuntu Powerful Hacks And Customizations

No comments: