1,330
edits
(update with complete writeup) |
No edit summary |
||
Line 4: | Line 4: | ||
# the sticks should be fast USB3 (very good results with SANdisk Extreme 32GB). The computers do ''not'' have to be recent, nor do they have to have USB3 ports. USB2 ports support up to 30MB/s, but only USB3 sticks deliver this! | # the sticks should be fast USB3 (very good results with SANdisk Extreme 32GB). The computers do ''not'' have to be recent, nor do they have to have USB3 ports. USB2 ports support up to 30MB/s, but only USB3 sticks deliver this! | ||
# we use Fedora 23 because its hardware support is very good. We always use the 64bit distro. | # we use Fedora 23 because its hardware support is very good. We always use the 64bit distro. | ||
# The stick can be booted on MacBooks as well; their hardware works well with Fedora 23. For Windows clients, one has to make sure that "fast boot" (or "fast startup") is disabled (or Shift is pressed while shutting Windows down), and sometimes < | # The stick can be booted on MacBooks as well (press the <code>alt</code> key at the boot sound); their hardware works well with Fedora 23. For Windows clients (press F11 or F12, sometimes F9 or F10 for the boot menu), one has to make sure that "fast boot" (or "fast startup") is disabled (or Shift is pressed while shutting Windows down), and sometimes <code>powercfg -H off</code> (as Administrator in a console window) is additionally required; otherwise the USB stick may not boot. Occasionally we find a computer that does not boot from the stick because the BIOS screen can not be reached (due to unknown BIOS password; happens with machines belonging to institutions which administer them centrally) or some such, but 19 out of 20 work as they should. | ||
# performance tuning (not strictly required): We use an ext4 filesystem and < | # performance tuning (not strictly required): We use an ext4 filesystem and <code>data=writeback,nobarrier </code> in /etc/fstab. To set the writeback option on the / filesystem one needs to use tune2fs on a Linux machine where the stick is just mounted (i.e. not booted from), with the option data_journal_writeback; one should also set nobarrier that way. With this tuning the stick feels as fast as a local harddisk (except for large writes, like CCP4 or Phenix installation). | ||
# we always create a few-GB FAT32 partition because that makes file exchange with Windows and Macs very simple | # we always create a few-GB FAT32 partition because that makes file exchange with Windows and Macs very simple | ||
# we just install CCP4 and whatever else we need (XDS, Phenix, Chimera, ..), and then dd or ddrescue (on a machine with USB3 ports) an image of that stick to all other sticks. | # we just install CCP4 and whatever else we need (XDS, Phenix, Chimera, ..), and then dd or ddrescue (on a machine with USB3 ports) an image of that stick to all other sticks. | ||
Line 15: | Line 15: | ||
# the SANdisk Extreme is the best stick we found; physically small sticks look nicer but are slow (even though they are called USB3) | # the SANdisk Extreme is the best stick we found; physically small sticks look nicer but are slow (even though they are called USB3) | ||
# the FAT32 partition should be the first partition on the stick; 2GB is enough for us. Then comes the Linux partition, with 13.9GB, so that the sum of the two partitions is slightly below 16GB. The third partition is then a 16.1GB /data partition. This scheme has the advantage that the image of the stick can just as well be copied (with dd or better ddrescue) to a 16GB stick; the /data partition then does not fit and cannot be used on that stick, but the operating system will then work on the small stick just as well. This requires that the /data partition is not mounted automatically from /etc/fstab (i.e. it should be listed, but with the noauto option), but rather with a command like | # the FAT32 partition should be the first partition on the stick; 2GB is enough for us. Then comes the Linux partition, with 13.9GB, so that the sum of the two partitions is slightly below 16GB. The third partition is then a 16.1GB /data partition. This scheme has the advantage that the image of the stick can just as well be copied (with dd or better ddrescue) to a 16GB stick; the /data partition then does not fit and cannot be used on that stick, but the operating system will then work on the small stick just as well. This requires that the /data partition is not mounted automatically from /etc/fstab (i.e. it should be listed, but with the noauto option), but rather with a command like <code>mount /data &</code> from /etc/rc.d/rc.local - because if the 16GB stick is booted, it will otherwise find a corrupt filesystem and the boot will fail, leaving you with a rudimentary shell prompt which only experts can recover from. Also this means that the image of the stick need only comprise the first 16GB (unless the /data partition already has something on it) - that makes it faster to copy it, and it is quite fast to re-create an empty /data partition after booting the stick. | ||
# it is a good idea to give easy root access to the one user you create because certainly some packages will have to be installed or updated when the stick is in use | # it is a good idea to give easy root access to the one user you create because certainly some packages will have to be installed or updated when the stick is in use | ||
# it is a good idea to save an image of the stick whenever you made a successful change; otherwise you might need to start from scratch if you mess something up. | # it is a good idea to save an image of the stick whenever you made a successful change; otherwise you might need to start from scratch if you mess something up. | ||
Line 25: | Line 25: | ||
This will create a USB stick capable to | This will create a USB stick capable to | ||
* EFI boot on | * EFI boot on Mac's | ||
* UEFI boot on PC's | * UEFI boot on PC's | ||
* BIOS boot on newer hardware (legacy boot / CSM enabled) | * BIOS boot on newer hardware (legacy boot / CSM enabled) | ||
Line 49: | Line 49: | ||
chroot: | chroot: | ||
chroot /mnt/sysimage | |||
install updates: | install updates: | ||
dnf -y update | |||
configure grub2 for (U)EFI systems: | configure grub2 for (U)EFI systems: | ||
Line 83: | Line 83: | ||
Install grub2 for BIOS boot and configure it: | Install grub2 for BIOS boot and configure it: | ||
rm /boot/grub2/grubenv | |||
(symlink to /boot/efi/EFI/fedora/grubenv in grub2-efi.rpm; binary file in grub2.rpm) | (symlink to /boot/efi/EFI/fedora/grubenv in grub2-efi.rpm; binary file in grub2.rpm) | ||
grub2-install /dev/sd? | |||
(also creates a new /boot/grub2/grubenv | (also creates a new /boot/grub2/grubenv | ||
grub2-mkconfig -o /etc/grub2.cfg | |||
check /etc/grub2.cfg and if needed, change at all positions | check /etc/grub2.cfg and if needed, change at all positions | ||
Line 96: | Line 96: | ||
some old computers still might not boot (they don't support booting from GPT). | some old computers still might not boot (they don't support booting from GPT). | ||
This can be fixed but the stick afterwards cannot boot on EFI/UEFI systems anymore. | This can be fixed but the stick afterwards cannot boot on EFI/UEFI systems anymore. | ||
a) set the boot flag (active) on the single 0xEE partition in the protective MBR by using fdisk version <= 2.22 (versions 1.23 and newer | a) set the boot flag (active) on the single 0xEE partition in the protective MBR by using fdisk version <= 2.22 (versions 1.23 and newer have GPT support and thus don't make changes to the protective MBR but to the GPT) (I used fdisk (util-linux-ng 2.17.2) on a ScientificLinux 6.7 machine) | ||
fdisk /dev/sd? | |||
a | |||
part 1 | |||
w | |||
b) recompute CHS values using option “h” in gdisk's expert menu: | b) recompute CHS values using option “h” in gdisk's expert menu: | ||
gdisk /dev/sd? | |||
x | |||
h | |||
m | |||
q | |||
this can be reversed: | this can be reversed: | ||
Line 116: | Line 123: | ||
fill empty part of all partitions on the stick with “zeros”: for each partition, do | fill empty part of all partitions on the stick with “zeros”: for each partition, do | ||
dd if=/dev/zero of=/mountpoint/delete.me bs=65536 # this will stop when filesystem full | |||
rm /mountpoint/delete.me | rm /mountpoint/delete.me | ||
Better: use the (enhanced) SECURITY ERASE UNIT feature of hdparm (quicker, and nicer for the device). | |||
save a compressed disk image: | save a compressed disk image - we use the parallel gzip program called pigz: | ||
dd if=/dev/sd? | pigz -c usbstick.img.gz | |||
(time: ~180 secs speed: ~175MB/s, size of image: 1.8 GB) | (time: ~180 secs speed: ~175MB/s, size of image: 1.8 GB) | ||
write compressed image back to a stick: | write compressed image back to a stick: | ||
unpigz -c usbstick.img.gz | dd of=/dev/sd? bs=4096 | |||
(speed should be >100MB/s) | (speed should be >100MB/s) |