This is not a dual boot installation.
This install guide is about how to install Ubuntu 'Karmic Koala' in a USB flash memory stick or Solid State Drive with the LUKS encrypted ext4 file system by running the Ubuntu Karmic Koala 'Alternate CD'. Flash technology is advancing rapidly and now SSD drives are starting to become affordable to the average consumer. SSD drives contain flash memory and are more robust than mechanical hard drives, they withstand physical shock and all kinds of environmental extremes better. They run cooler and use less power because they contain no moving parts. SSD drives are also much faster than mechanical hard disc drives. Flash memory isn't called 'flash' for nothing.
You may want to install Ubuntu Karmic Koala in a USB flash memory stick or SSD if you want to be able to carry your entire operating system along with all of your files and settings around with you in your pocket. Files people may need will probably including work and business files as well as vital personal information, passwords and so on. Unfortunately, they're also easy to lose, misplace or to have stolen from you. Without an encrypted file system anyone with physical access to your USB flash memory stick, SSD drive or laptop or can access all of your files. If you own a USB flash memory stick or a laptop with an operating system installed in it, you should at least have an encrypted /home directory to protect any sensitive files from unauthorized access. The Karmic Koala 'Alternate Installation' CD allows us to easily install our Ubuntu operating system in a fully encrypted ext4 file system. With an encrypted file system, only someone who knows your pass phrase can access your personal information or your corporate, political or military secrets. The ext4 file system will be the new default file system for Ubuntu. Ext4 is by far the most advanced file system available today for SSD drives and flash memory. The ext4 file system is ready to support the new ATA TRIM command for flash memory, as soon as flash memory and SSD manufacturers begin to make hardware available that will support the new command. Drives plugged in by the USB connection have never been as fast as drives plugged in by IDE or SATA cables, so of course the operating system will work a little slower. That is to be expected. New technology in USB drives is just around the corner, it's called USB3, and basically it will mean that in the future the USB interface will be about the same speed as a SATA_II connection, and roughly ten times faster than the high speed USB we use now. LINKS:
For now though the reality is, most of us are still stuck with plain old fashioned USB flash memory sticks or USB external hard disk drives. I've made the leap and invested in a real SSD. I know I won't have any USB3 capable hardware for some time yet though. Even so, it's still good practice to try to do the best we can with what we have. To perform this installation you will need,
A normal Ubuntu installation to a hard disk in a standard computer, for example one with a 3.0 Ghz CPU and 512 MB or RAM, might take about half an hour. Most USB flash memory sticks are pretty slow to write to. This installation could take a while if you're using a flash memory stick. Write speeds vary greatly between different kinds of flash memory sticks. I think an average flash memory stick should take around one or two hours to install Ubuntu in. The slowest USB flash memory stick I have tried took almost three hours to perform this installation. Once the system has been installed, it will run okay in most flash memory sticks because most flash memory is quite fast to read from and that makes up for it's slowness with disk writes. Most of us probably do a lot more reading than writing. SSD drives are much faster to write than flash memory sticks if you're lucky enough to have an SSD drive in your possession. As I understand it, they contain a lot of pieces of flash memory in parallel to get around the slow write speed issue, so SSD drives are about as fast as we can get both ways, (read and write). The USB2 interface will be the slow part if you have an SSD drive in an external USB drive caddy like I do. This is not an official Ubuntu website.
External Links:
|
| To begin, you need to place your CD in your CD-ROM drive and re-start your computer. You should see something like the illustration below in your monitor. ![]() fig 1 ![]() fig 2 The choices here are: F1 for Help - explains what the other modes are for, (F2 to F6). Check the CD-ROM for defects, that is a good idea! I recommend checking the CD for defects. It only takes five minutes or so and might save you hours of frustration if you have a bad burn. You already ran an md5sum test on your .iso download too, of course. Test Memory, you can test your computer's RAM to make sure it's okay. (Memtest86+) Boot from first hard disk, - useful if you left the CD in the drive by accident and you really wanted to boot the computer up without running the CD. Rescue a broken system, - Rescue Mode Install Ubuntu - The text mode install, this is the correct item to choose here. It's a good idea to scroll down one line and check your CD for defects first though. I will run through the rest of the options below, but this option is the one that this web-page is mainly about.
|
Start of the first stage of the installation As I mentioned first, I pressed 'Enter', for the 'text mode install', and here's the first decision, (below), it's an easy one. ![]() fig 3 Choose your language. Your arrow keys can move the red rectangle up or down the list to select a language. Then press 'Enter'.
The <Go Back> option is shown in the lower left corner of almost every panel. It does the same as explained above (read <Go Back> again). Your 'Tab' key is the one to use throughout this installation for moving the red highlighting from 'Yes' to 'No' or 'Go Back'. This can be a very handy thing to know about. For one thing, it is useful if you need to go back one or two steps and repeat something you didn't get right. There are also things you can do from the 'Ubuntu Installer Main Menu' later on, after the install. For example, if you need to re-install Grub or Lilo boot loaders to your MBR or to a partition, you might want to access these options from the Ubuntu Installer's Main Menu. You don't necessarily have to be doing an install to run the Ubuntu Install CD. You can also use the Ubuntu Install CD's partitioner to do partitioning work if you need to. Nowadays a GParted -- LiveCD is better for that though. The 'Ubuntu Installer Main Menu' also offers an escape route in case something has gone wrong and you need to abort the installation and re-boot to fix something. Or it may be that you have suddenly realized you have made a mistake and wish to cancel everything and try again. If you do find yourself wanting to do this, just be aware that the line for 'abort the installation' and it is right down below the bottom of your monitor's screen, and out of view. People may not realize they need to scroll down to find it. Highlight that and press 'Enter', and be ready to remove your CD from it's drawer or it will boot from the CD again before you know it.
Choose your country. (Use your up or down arrow keys for scrolling, then press 'Enter')
If you have a special keyboard, you can choose <Yes> for a series of keyboard tests to help Ubuntu set up your special keyboard correctly. You will be asked to press certain keys. I chose <No> for this, to skip the keyboard tests and move on to choose my keyboard from a list.
This will be faster.
Choose your keyboard.
The USA keyboard is the standard choice for most people in the world, even if I live in Australia. We use the USA style keyboard here.
If you forgot to plug your ethernet in and network autodetection fails, highlight <Go Back> in the next screen, plug your network in and try again.
Give your new operating system a host name. The way to do this is to move the cursor to the left with your 'backspace' key, and type in whatever you like here. Press your 'tab' key to highlight '<continue>', and press 'Enter' when ready.
End of the first stage of the installation |
Start of the partitioning stage of the installation
For this installation we're choosing the fifth option, use an entire disk and set up encrypted LVM.
In this illustration I am being shown a list of my hard disks. The computer I am installing in now has three hard disks at the moment, plus my USB external SSD drive, that makes four disks. I'm selecting my fourth disk, which is my 64. GB USB SSD drive. You may use a USB flash memory stick of sufficient capacity instead if you don't own an SSD drive.
We are being reminded about which hard disk we have decided to format. This will be our last chance to change our minds and cancel the installation if we suddenly remember there might be some data on that disk we might want some day that hasn't been backed up. Also, take note of which disk you're installing in so you cn install GRUB to MBR in that disk later on in the installation process. You may wish to write this information down on some scrap paper to make sure you won't forget it. |
End of the partitioning stage of the install |
Start of the final stage of the installation
I just type in my first name and surname here. You are allowed to use capital letters. Whatever you type here will be remembered by your new system and used for automatically configuring some things like parts of your email account. Make sure you don't type anything foolish here because your e-mail recipients might be reading this some day.
Your first name should automatically appear here as a default username. You can change it to a nickname if you want, and with numbers too if you like. (Check your numlock). Lower case letters only though, no capitals.
It is a good idea to write your new username and password down and keep them on a piece of paper for a while until you are sure you will remember them. You will need them to log in to your new system.
It's no good double-doing file encryption, we already have an encrypted /, we don't need to also encrypt /home too. I tried it and I suspect that may have made my system slow opening my /home/username directory, and I couldn't access it for simulated file rescue either. I don't recommend encrypting /home if the / (root) is already encrypted.
I always just skip this one by leaving it blank and selecting <Continue> Those who need it will probably know what to do here.
This process involves a lot of writing to the disc, so this part of the whole installation takes a lot of time. How fast does your computer write data to disk? (Or how fast can your disk take it?). You will have time to go do some martial arts exercises or have a cup of coffee or whatever it is you like to do.
The Ubuntu installer wants to install GRUB, the GRand Unified Bootloader to MBR in the computer's first hard disk. This is not what we want if we are trying to install Ubuntu in a USB. I will choose <No> for a chance to specify where else I might want to install GRUB instead, (the USB disk's MBR or the boot sector of the /boot partition). Choosing 'No' doesn't mean GRUB will not be installed, it just means we don't necessarily want to install GRUB's IPL to first hard disk's MBR. Maybe we want to install GRUB's IPL somewhere else?
This panel comes next, you can type in a custom location on the dotted line to specify where exactly you do want GRUB to be installed. If you want GRUB's IPL installed to your second hard disk's MBR instead of your first one, type (hd1) or /dev/hdb here. If you want GRUB's IPL installed to your third hard disk's MBR instead of your first one, type (hd2) or /dev/hdc here. If you want GRUB's IPL installed to your fourth hard disk's MBR instead of your first one, type (hd3) or /dev/hdd here. I'm typing in '(hd3)', because I already have three hard disks inside this computer, and my USB external SSD will be disk number 4. BE CAREFUL HERE, because there are a few computers which might list any USB drive as first hard disk instead. Many computers have a BIOS that allows the user to easily choose which hard disk to boot. Mine does, click hard disk boot priority to see what I mean. Then you can either enter your BIOS to set which MBR to boot or use another system's GRUB to chainload any disk you want providing there's valid boot loader code in its MBR.
|
At this point, my CD drawer pops open automatically and I remove my CD from it and press 'Enter'. Some computers might not have a CD drawer with a mechanism to open the CD-ROM drawer automatically. If this is the case, you should remove your CD manually.
![]() fig This is not actually the Karmic Koala login screen yet, to do! You'll see the new login screen for Ubuntu in your USB flash memory stick. I just need to type in my user name, then it will ask me for my user password. ![]() fig This is not actually the Karmic Koala desktop either, to do! When you have made it this far, your new desktop should be different from the one shown in the illustration above. Congratulations! You have successfully installed Ubuntu in a USB flash memory stick! |
| There are a few optional things to do to make Ubuntu work the way I want it to. 1. Reduce swappiness In this installation the swap area is built in, inside the encrypted LVM volume, so we will be using our flash memory to write our swap data to and read from. Writing to flash memory is generally a little slow. The idea of reducing swappiness here is to cause the operating system to prefer not to use the swap area too much and prefer to use the memory modules instead. The operating system should be a lot faster if it uses the memory modules instead of the swap area. By using this method, the swap area is still available to the operating system in case it is really needed. Open your /etc/sysctl.conf file with gedit text editor,
/etc/sysctl.conf
See: Performance tuning with 'swappiness' - Ubuntu Community Docs. 2. Edit /etc/fstab with noatime option. Theodore Ts'o, the lead developer of the ext series of file systems recommends mounting the ext4 file system with the noatime option when using in in flash memory sticks or SSD drives, please read this link, SSD’s, Journaling, and noatime/relatime. I'm taking his advice. Open the /etc/fstab file with gedit text editor,
/etc/fstab
This means Ubuntu will no longer go to the extra work of updating the access time (atime) every time we open a file. To see what I mean, right-click on any file and click 'properties', and you'll see the last access time listed there. 3. GNU GRUB - also see this website's GRUB2 Pages. Splashimage You might like to set up your GRUB with a beautiful splashimage, GRUB2 Splashimages. noop i/o scheduler One more thing that can be done in GRUB would be to add the kernel option for the noop I/O scheduler to the GRUB menu. Noop scheduler - wikipedia. As far as I know, cfg is the default I/O scheduler for Ubuntu. An I/O scheduler is useful for re-organising writes to hard disk drives so that instead of just doing things in chronological order, writes that are physically close to where the hard disk's read and write heads may happen to be at any point in time will be done first. Writes to places on the hard disk that are a long way away from the read and write heads will be held for later. That's a more efficient way to manage mechanical hard disks, and it usually results in better performance. Flash memory doesn't have any read-write heads or controller arms, so we don't need any fancy, complicated I/O scheduler, for us it might even slow things down. It is widely believed that using the simpler noop I/O scheduler will speed up your system and anyway it's all we need if we're mainly reading and writing to and from flash memory .
Save and close the file.
How to add kernel options - TWEAKING GRUB 2 - Dr.Lock Switching IO Schedulers on runtime - www.LinuxHowtos.org The downside could be that booting with the 'elevator=noop' kernel option changes the way the kernel write to all disks, at least according to Blazeix in post #5 in Enable noop scheduler by default for an SSD - Ubuntu Web Forums. So what happens when we have a want to use the USB flash memory operating system to write to a hard disk? Probably it will be just a little bit slower. We could edit /etc/sysfs.conf instead, but that method seems to tie the USB to a device file name like /dev/sda. If it can handle UUID numbers it would be great. I'll update this topic if more information comes to light. 4. Update and upgrade It's time to open up our repositories and get an update, install the software we want, and start configuring, personalizing and customizing our Ubuntu installation. Here's a link to a page with some information to get you started, Post-install Page. 6. Skip the login screen During boot up, we have to type our LUKS encryption passphrase to open the file system, then we see the login screen and type in our user name and user password before we see our desktop. It's okay to leave it like that if you want the extra security. If you are the only person who will be using this operating system, you might find it inconvenient to be typing two passwords for every boot-up. The LUKS passphrase should be enough. Go 'System'-->'Administation'-->'Login Window'. Under the Security tab, check 'Enable Automatic login' Type your username in the 'User' field. From now on your operating system will boot up directly to your own desktop and not stop at the login screen and not ask for your user name and password. 6. Install Logical Volume Manangement GUI 'Applications'-->'Add/Remove Programs'-->'System Tools'-->'Logical Volume Management'. GParted isn't designed to be able to manipulate Logical Volumes, but Logical Volume Management can. I don't know much about LVM yet, but it's bundled with the encryted installation. It doesn't seem to me as if LVM will be useful in this particular type of installation. LVM is an interesting subject for another web page and and some other day. External Links: Get to know Ubuntu's Logical Volume Manager - Linux.com An introduction to Logical Volume Management - DistroWatch Linux’s Logical Volume Management - David Hogue RAID-5 Encrypted with Logical Volume Management - TJ 7. Run 'sudo apt-get clean' This is only useful if you have installed in a small disk and you need to regain some disc space. Linux file systems work best if the file system is kept less than about 80% full. The command for checking file system usage is 'df -h',
Software packages come in .deb files which are downloaded from the internet and stored in /var/cache/apt/archives/, and after the software has been installed, the left-over .deb files remain in /var/cache/apt/archives/ in case they're ever needed again. Normally, I like to leave them there so I can make a backup of them if I ever need to re-install for some reason. (Sometimes I do some risky experiments). That way I don't need to re-download them all from the internet again. In a USB flash memory stick where I don't have the spare disk space, it's often best to get rid of all those .deb packages sitting around in there, not doing anything. The quickest and easiest way to do that is to run 'sudo apt-get clean',
In my 4 GB USB flash memory installation, my disk usage was reduced from 77% used to 68% used, so I cleared a significant proportion of my disk space. In a larger disk, this command might be a waste of time, and actually, those with slow internet speeds or a low monthly bandwidth allowance might want to do the opposite and make a backup of their /var/cache/apt/archives instead. 8. SSH Networking Control your home computer and access all your stored data in it from anywhere you may travel with your USB flash memory stick. Install your SSH Networking software in your home or office computer running Ubuntu and set up 'port forwarding' to your internet modem. SSH stands for 'Secure SHell'. The port you use will be password protected and your password and data will be transferred securely over the internet in encrypted form. There are some extra security precautions you can add as well if you think they're necessary. See this website's SSH Network page. |
| Important Parts of a Flash Disk Drive It's probably not recommended for you to open an SSD drive or thumb drive, but there are some nice photos in the following recommended link, Vertex Internal Components - BenchmarkReviews.com If you look in that link, you'll see pictures of the following items on the circuit board, Cache Memory SSD drives have a cache memory just like hard disk drives do, it's a fast SDRAM module where data can be quickly queued up while it's waiting to be written to the flash memory. Flash Memory Controller Chip The flash memory controller chip makes the flash memory ICs and the dies inside them appear on the surface to the operating system and the user as if they are a hard disc drive. The flash memory controller chip takes care of logical block addressing, wear leveling, bad block management and if there are more than one flash memory ICs, then it might organize the ICs into a RAID0 array for faster reads and writes. Flash Memory ICs These are the rectangular boxes that contain the flash memory itself. A USB flash memory stick may contain one, two or more of these, but most commonly they only contain one. In an SSD drive there can be eight of more memory ICs. The flash memory ICs can also be stacked on top of each other piggyback fashion to save space on the SSD board if necessary. |
| Flash Memory Wear - Measuring writes to disk - disk I/O Will Your Flash Memory Wear Out? The short answer is 'Yes', probably it will some day, but that depends on what kind of flash memory you have, how large it is, what you use it for and how much time you spend using it. The fact is, I don't know because none of my flash memory devices have worn out yet. Flash memory has a bad reputation for wearing out. This is a carry-over from days gone by when it was not yet designed for this kind of use but people went ahead and installed operating systems in it anyway. You can still get flash memory that isn't very well suited for prolonged hard work and there are plenty of people around the internet who have nothing better to do with their time than to spread the FUD - (Fear, Uncertainty and Doubt). Attitudes are changing though. Here's a link to a survey being carried out by some Linux users, Flash Drive Lifespan Survey - NSLU2 Did you take a look at the flash drive lifespan survey linked above? Those flash memory sticks are small, between 512 MB and 4 GB. The oldest were made way back in 2006, so they're using old technology. Only two out of fifteen are reported to have failed so far. Many of them have a root file system in them running 24/7. Flash memory technology is advancing rapidly and scientists and engineers are putting a lot of work into it. The length of time your flash memory will last will depend on what kind of flash memory product you have, SD drive, thumb drive, SSD drive, and the work the manufacturer invested in it. An item like a camera card is designed to be small and not very many people will install an operating system in it. It seems unlikely to me that camera card can be expected to have a disk controller with advanced wear levelling features. They're simply not designed for this kind of use. USB flash memory sticks are available in a wide range of sizes, prices, and speeds. Most of them are not really designed for installing operating systems in, but most of them do have pretty good endurance capabilities anyway. We can only guess about that. A few of the best come with guarantees, and there is at least one brand that is guaranteed for life. SSD drives are being designed for operating system use and these are getting better and better. Wear Levelling Your operating system doesn't actually write directly to the flash disk like a lot of people seem to imagine. We're actually writing to the flash memory's controller chip and the controller chip writes data to the flash memory. The flash memory controller chip makes the flash memory look to like a disk when viewed from the operating system side. Underneath, it controls electronic pathways leading to blocks of flash memory made of stacks of wafers containing mazes of honeycomb like lattices of flash memory tranistors. Nearly all thumb drives and SSD drives today will have some kind of wear levelling program built into their controller chip. There are two kinds of wear levelling, and most flash memory uses some combination of each. Dynamic wear leveling 'Dynamic Wear Levelling' works by shuffling around all the 'dynamic' (free) erase blocks, the ones that aren't currently in use for storing data. Blocks containing static data are not included. That means if your system and files fill up say 75% of your drive, only 25% of your drive is left over for wear levelling. That will still give you 25 times the endurance than if your drive didn't use any wear levelling at all. However, it's still only about 1/4 of the endurance that would be possible if the entire storage space could be rotated. Static-wear-leveling 'Static Wear Levelling' involves a much more complex process which keeps track of the useage of blocks and tries to write data to the least used physical blocks. A static wear level algorithm evenly distributes data over an entire system and searches for the least used physical blocks. Once it finds them, it writes the data to those locations. If blocks are empty, the write occurs normally. If they contain static data, it moves that data to a more heavily used location before it moves the newly written data. You calculate the endurance of a storage system using static wear leveling to be 100 times better than an approach without wear leveling. A system with 75% of the storage containing static data is four times better than a card that implements dynamic wear leveling. Static wear leveling provides better endurance because it writes data to all blocks of the storage system. Here's an interesting article which gives us mathematical equations we might use to try to predict the endurance of a flash memory drive, Accurately judging endurance for solid-state storage - EDN, 1/19/2006 - Gary Drossel As you can see if you read that article, the size of the drive compared with the proportion of used and free space is a factor, and also the type of wear levelling that is used. Here's another interesting web page that explores the endurance of flash memory drives, SSD Myths and Legends - "write endurance" - classic article - storagesearch.com Block erasure One limitation of flash memory is that although it can be read or programmed a byte or a word at a time in a random access fashion, it must be erased a "block" at a time. Each flash drive is made up of a series of erase blocks. These typically are 2mb in size. - http://managedflash.com/understanding/wear.htm Another way of thinking of this is that even if your data is only one megabyte in size, the average write will still always be 256 kilobytes. This generally sets all bits in the block to 1. Starting with a freshly erased block, any location within that block can be programmed. However, once a bit has been set to 0, only by erasing the entire block can it be changed back to 1. In other words, flash memory (specifically NOR flash) offers random-access read and programming operations, but cannot offer arbitrary random-access rewrite or erase operations. A location can, however, be rewritten as long as the new value's 0 bits are a superset of the over-written value's. For example, a nibble value may be erased to 1111, then written as 1110. Successive writes to that nibble can change it to 1010, then 0010, and finally 0000. In practice few algorithms can take advantage of this successive write capability and in general the entire block is erased and rewritten at once. Although data structures in flash memory cannot be updated in completely general ways, this allows members to be "removed" by marking them as invalid. This technique must be modified somewhat for multi-level devices, where one memory cell holds more than one bit. to do:
(brand) Information on the internet |
| Flash Memory Performance - Benchmarking Ubuntu Linux Disk Encryption Benchmarks - by Michael Larabel to do:
|
| Why the new ATA TRIM command is important The Anatomy of an SSD - Anandtech p5 Putting Theory to Practice: Understanding the SSD Performance Degradation Problem Byte Conversion Calculator - T1 Shopper |