Make it persistent

This page describes the following steps:

3. Resize fat32 boot partition
4. Add ext4 “casper-rw” partition
5. Add Ubuntu persistent to boot menu

Requirements:

– Something that runs Ubuntu (or another operating system that runs Gparted)
– The Ubuntu drive we made in the previous page (of course..)

3. Resize fat32 boot partition

For this step you need Ubuntu (or any other operating system that can run Gparted). Applications like Disk Utility (the OSX partition manager) doesn’t seem to be able to resize partitions and/or create ext4 file systems. And you can’t use the bootable Ubuntu drive we just created, because we have to unmount the boot partition to resize it – which is not possible.

The fat32 boot partition only has to be about 1GB in size. Since Rufus turns your drive into one big partition, we are going to resize this (also; we need space for the “casper-rw” partition we create in the next step)

Why 1GB although currently only 750MB is used?
I do not recommend this; but when you upgrade to another Ubuntu version (e.g. from 12.04 to 12.10) or update the kernel, the upgrade-application writes files to the boot partition. For this reason I like it to be at least 1GB – just to be sure.

First, we need Gparted. The easiest way is to use the Ubuntu Software Center:

Gparted

Now we will resize the fat32 boot partition…

– Startup Gparted
– Select your Ubuntu drive from the drop-down-menu in the right-upper-corner
– Right click on the drive and select “unmount”
– Right click again and select “resize”
– Set size to something like 1000MB

Gparted_resize

Probably there’s a masochistic way to do all of this with the terminal. But if you like doing things the hard way, I will make this even more pleasant for you by not helping you in any way possible.

4. Add ext4 “casper-rw” partition

This part you can do when booted from your new external Ubuntu drive!

In persistent mode the partition labeled “casper-rw” is by default used to save any changes:

– changes/updates made to the operating system
– installed software/applications
– and anything saved in the home folder (Documents, Downloads, Desktop, etc.)

So we need to add an casper-rw partition..

– Open Gparted again (if it isn’t still running)
– Select your Ubuntu drive in the right-upper-corner
– Right click on the (grey) unallocted space and select “New”
– Set the size of the partition to what you desire (probably at least 2GB)
– Set the File system to ext4 (ext4 is best because of read/write cycles)
– Label it “casper-rw” (exactly this name)

Gparted_Casper

5. Add Ubuntu persistent to boot menu

The Ubuntu USB stick uses two boot menu’s; Grub and Syslinux. Therefor you have to change two files:

/boot/grub/grub.cfg

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

menuentry "Ubuntu persistent" {
    set gfxpayload=keep
    linux    /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper persistent quiet splash --
    initrd    /casper/initrd.lz
}
menuentry "Try Ubuntu without installing" {
    set gfxpayload=keep
    linux    /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
    initrd    /casper/initrd.lz
}
menuentry "Install Ubuntu" {
    set gfxpayload=keep
    linux    /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash --
    initrd    /casper/initrd.lz
}
menuentry "Check disc for defects" {
    set gfxpayload=keep
    linux    /casper/vmlinuz.efi boot=casper integrity-check quiet splash --
    initrd    /casper/initrd.lz
}

[the bold part is new/changed]

/isolinux/txt.cfg

default persistent
label persistent
  menu label ^Ubuntu persistent
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/preseed/ubuntu.seed boot=casper persistent initrd=/casper/initrd.lz quiet splash --
label live
  menu label ^Try Ubuntu without installing
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash --
label live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz.efi
  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash --
label check
  menu label ^Check disc for defects
  kernel /casper/vmlinuz.efi
  append  boot=casper integrity-check initrd=/casper/initrd.lz quiet splash --
label memtest
  menu label Test ^memory
  kernel /install/mt86plus
label hd
  menu label ^Boot from first hard disk
  localboot 0x80

[the bold part is new/changed]

Also you need to change this to see the menu:

/isolinux/isolinux.cfg

# D-I config version 2.0
include menu.cfg
default vesamenu.c32
prompt 0
timeout 50
# disable the next line (with #) to see the boot menu
# ui gfxboot bootlogo

[the bold part is new/changed]

Read the “Optimize“-section to learn how to boot directly to Ubuntu (skipping all the menu’s). Also read that page for the changes you need to make in case you want to update the kernel or upgrade to a new Ubuntu version (e.g. from 12.04 to 12.10).

<< Make USB drive Top Add user and encryption >>
Advertisements

2 thoughts on “Make it persistent

    1. @Thiago, you do realise this is for a bootable USB stick, I hope? Installing Ubuntu on a fixed hdd doesn’t require editing any editing of core files.

      Trying to run a complete Windows system from a USB stick while also storing data on said stick, now that is an altogether different matter. 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s