john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Linux on usb

http://www.debian-administration.org/articles/179

We will create two partitions on the USB key, one for /boot and one for / (root). We do not create a swap partition because that would prematurely age the usb key. You may mount and use swap partitions from the local harddrives ala knoppix but that is up to you.

mkfs.ext2 /dev/mapper/rootfs mkfs.ext2 /dev/sdd1 sync ; sync

e2label /dev/sdd1 PRIVDEB_BOOT

In deference to the flash memory I chose ext2 (and maybe it will run faster?) - I'll have to tunefs to never check...

I chose ext2, no swap partition, and noatime on my 1 big / (root)


besides ext2 with noatime we can do a little more to squeeze our debian on vbox on a flash disk

Since an SSD is not a conventional disk, the "elevator" scheduler actually gets in the way.

By adding elevator=noop to your kernel boot parameters in your /boot/grub/menu.lst

Change the file system mount options on SSDs to "noatime". On certain Linux distributions, such as Ubuntu, the default is "relatime". This tells the kernel to write the Last Accessed Time attribute on files. Conversely, "noatime" tells the kernel not to write them, which considerably improves

performance

/etc/fstab: static file system information.

proc /proc proc defaults 0 0

/dev/sdb1 / ext3 noatime,errors=remount-ro 0 1 /dev/sda1 /data ext3 noatime,errors=remount-ro 0 1 /dev/sdb2 swap sw 0 0 /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

BETTER YET, USE EXT2 AND HARDWARE RAID (second disk has ext3? to prevent sudden power outage data corruption? or UPS?)


sudo gedit /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0 tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0 tmpfs /var/log/apt tmpfs defaults,noatime 0 0

Your log files will vanish after each reboot. But other than that, there are no harmful side

effects from this operation.

none /var/cache unionfs dirs=/tmp:/var/cache=ro 0 0

unnecessary writes, and the solution here is to edit your /etc/fstab file so that it uses

tmpfs (otherwise known as a RAM disk) for the /tmp directory. For example: tmpfs /tmp tmpfs nosuid,nodev 0 0


  • « Linux optimize performance of hard drive with hdparm
  • Linux redundant network card nic bonding »

Published

Feb 6, 2010

Category

linux

~331 words

Tags

  • linux 249
  • on 26
  • usb 7