Install voodoo b1 from usb flash memory
From ArchWiki
There was a step back in the new Arch Voodoo Beta 2 release, so this now only applies to Beta 1 or future installers using grub.
Contents |
[edit] Pre-requisites
- Host computer running arch and with grub installed
- Internet Connection ( for iso download )
- USB Flash Memory ( at least 10% bigger than the iso you want to use )
First we need to get the beta 1 iso for the greatest GNU/Linux distro around, http://www.archlinux.org/.
Today Feb 14 2007 the only way to get your grubby little hands on it is via ftp://ftp.archlinux.org/other/0.8/
You may download the current, ftp or my personal favourite base and customize it with the update script, it depends on the size of the flash key and any extra uses you might have planed for it.
[edit] Prepare
Plug your flash memory into any trusted, working and accessible usb port on your host computer
Find out what device the flash was assigned.
$ dmesg | tail usb 1-3: new high speed USB device using ehci_hcd and address 4 usb 1-3: configuration #1 chosen from 1 choice scsi5 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 4 scsi 5:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS SCSI device sdb: 2015232 512-byte hdwr sectors (1032 MB) sdb: Write Protect is off sdb: Mode Sense: 23 00 00 00 sdb: assuming drive cache: write through sdb: sdb1 sd 5:0:0:0: Attached scsi removable disk sdb sd 5:0:0:0: Attached scsi generic sg2 type 0 usb-storage: device scan complete
In my case the device I will work with will be "sdb" as you can see from the output of the last command, but for safety we will call it "sdx".
Now it's time to get partitioning!
[edit] Partitioning
[edit] You have two choices
-
[edit] Double Mint
Two partitions - one for the install and the other for misc storage
[edit] Pros
* You can keep things separate * VFAT: You can format the second partition in VFAT so you can use the flash memory with winblows machines[edit] Cons
* You will have two mount points bugging you all the time * VFAT: Bye bye permission data -
[edit] Big Red
Single partition separated by directories and protected by permissions
[edit] Pros
* One mount point
[edit] Cons
* You have a slim chance of accidental deletion of an important directory if not first secured using permissions
[edit] Double Mint
Let's get started, we will create the partition structure
# fdisk /dev/sdx
Let's create a new partition table
Command (m for help): o Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.
Let's create the first partition ( arch )
Command (m for help): n
Command action
e extended
p primary partition (1-4)
We will make a primary partition
p
This will be partition number 1
Partition number (1-4): 1
This partition will begin from cylinder 1
First cylinder (1-1015, default 1): ( press return )
Here you will have to round up the size of the ISO + 10%
CURRENT ISO 550MB + 55MB = 605MB BASE ISO 150MB + 15MB = 165MB FTP ISO 20MB + 2MB = 22MB
Last cylinder or +size or +sizeM or +sizeK (1-1015, default 1015): +165M
Let's create the second partition ( storage )
Command (m for help): n
Command action
e extended
p primary partition (1-4)
We will make a primary Partition
p
This will be partition number 2
Partition number (1-4): 2
This partition will be default all the way
First cylinder (199-1015, default 199): ( press return ) Using default value 199
Here you will press return again
Last cylinder or +size or +sizeM or +sizeK (199-1015, default 1015): ( press return ) Using default value 1015
If this partition will be formatted using VFAT then let's change the system id
Command (m for help): t
Partition 2
Partition number (1-4): 2
W95 FAT32 is 'b'
Hex code (type L to list codes): b
Now we must make the first partition active ( boot )
Command (m for help): a
Our boot partition is 1
Partition number (1-4): 1
Where all done here, let's write the new partition table.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.
Now we can format our second partition:
If you want to make it ext2/ext3
# mke2fs -j -L storage /dev/sdx2
Or if you are like me you might want to use reiserfs
# mkreiserfs -l storage /dev/sdx2
Maybe your not cool and decide to make it VFAT
# mkdosfs -v -n storage -F 32 /dev/sdx2
[edit] Big Red
Let's get started, we will create the partition structure.
# fdisk /dev/sdx
Let's create a new partition table
Command (m for help): o Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.
Let's create the main partition ( arch )
Command (m for help): n
Command action
e extended
p primary partition (1-4)
We will make a primary partition
p
This will be partition number 1
Partition number (1-4): 1
This partition will be default all the way
First cylinder (1-1015, default 1): ( press return ) Using default value 1
Here you will press return again
Last cylinder or +size or +sizeM or +sizeK (1-1015, default 1015): ( press return ) Using default value 1015
Now we must make the first partition active ( boot )
Command (m for help): a
Our boot partition is 1
Partition number (1-4): 1
We're all done here, let's write the new partition table.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.
[edit] Format
It's time to format our new arch partition
If you are a ext2/ext3 fan:
# mke2fs -j -L arch /dev/sdx1
Or If you are a reiserfs fan:
# mkreiserfs -l arch /dev/sdx1
[edit] Copy
Let's make an iso mount point:
# mkdir -p /mnt/iso
Mount downloaded iso
# mount -o loop /path/to/the/arch/cd.iso /mnt/iso
If everything went well you should see the iso's contents via 'ls':
$ ls /mnt/iso arch boot
We also need to make a temporary mount point for our boot partition
# mkdir -p /mnt/tmp
Mount our fresh boot partition
# mount /dev/sdx1 /mnt/tmp
If all went well we can start the copy process
# cp -rav /mnt/iso/* /mnt/tmp/
[edit] Make it boot
Systems that can boot-up via flash memory treat the contents like a fixed drive, that said, we will need to modify the original cd contents.
You will need to modify the arch menu list:
All the (hd0,0) roots need to be changed to (hd1,0)
All the (cd) roots need to be changed to (hd0,0)
The easy way to accomplish this is to run this command.
# cat /mnt/iso/boot/grub/menu.lst | \
sed -r 's/hd0,0/hd1,0/' | \
sed -r 's/\(cd\)/\(hd0,0\)/' > /mnt/tmp/boot/grub/menu.lst
Here is why your host arch system needs to have grub installed
We need to copy grub's stage files
# cp /usr/lib/grub/i386-pc/* /mnt/tmp/boot/grub/
If that command failed because the stage files are no longer located in '/usr/lib/grub/i386-pc/', we can still use your grub boot loader's stage files
# cp /boot/grub/*stage* /mnt/tmp/boot/grub/
Now let's make a identifier so we can confirm our partition in grub console
# touch /mnt/tmp/boot/grub/.usb
Let's start up grub
# grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
Here is where our little identifier comes in handy
grub> find /boot/grub/.usb (hd1,0)
In my case hard drive '1' partition '0', your result may vary
We need to tell grub where it's files are located
thats result from our last command (hd1,0)
grub> root (hd1,0) Filesystem type is reiserfs, partition type 0x83
Finally we tell it to generate the MBR, you need to tell it what hard drive ( in my case hd1 )
grub> setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/reiserfs_stage1_5" exists... yes
Running "embed /boot/grub/reiserfs_stage1_5 (hd1)"...
19 sectors are embedded. succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+19
p (hd1,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
That's it, now we quit
grub> quit
[edit] Permissions
Let's make sure root is owner of all and allow users the joy of knowing
# chown -R root:users /mnt/tmp/
Now this will allow users to create directories and files in the partition while forcing the group 'users',
great if you want to share your flash with your friends and family.
# chmod 2775 /mnt/tmp/
If you want to have the latest packages on your new install,
try out the Update section before you un-mount.
OK your done!!
Let's get rid of the iso mount
# umount /mnt/iso
And now we un-mount the boot partition,
It might take a little bit since it needs to flush
# umount /mnt/tmp
We now eject it safely
# eject /dev/sdx
Now go test it out !
[edit] Update
This update script was made to keep you arch install packages nice and fresh,
I have tested it on two systems with great results.
[edit] Usage
aip-update.sh /arch/install/location
/arch/install/location can be the usb flash memory root ( it must contain arch/pkg and arch/pkg/setup directories )
You can select what packages to include by doing some minor modifications to the script:
#!/bin/bash # # Arch install package updater # by Guillermo A. Amaral (thewonka) <me@guillermoamaral.com> # # packages to include # base PKGINCLUDE=( base !daemons !devel !editors !lib !multimedia !network !office !system !x11 ) # current # PKGINCLUDE=( base daemons devel editors lib multimedia network office system x11 ) REPO='ftp://ftp.archlinux.org/0.8/os/i686' #REPO='ftp://ftp.archlinux.org/0.8/os/x86_64' ***snip***
If you downloaded the 'base' iso and decided to make an updated current install,
comment the 'base' PKGINCLUDE and un-comment the 'current' PKGINCLUDE,
or remove the '!' from any package group you might want to include in your install
If you are willing to test it out on your new install, you can run this before you un-mount the boot partition,
remember if you got the 'current' iso or want to customize the categories included,
you will need to adjust the first few lines of the 'aip-update.sh' script.
aip-update.sh /mnt/tmp
[edit] Download
[edit] END
ref: http://blog.guillermoamaral.com/2007/02/15/install-arch-linux-08-from-usb-flash-memory/ Guillermo A. Amaral (thewonka)