Ubuntu storage expansion guide

Discussion in 'Linux' started by mallard, Aug 28, 2008.

  1. mallard

    mallard

    Joined:
    Aug 26, 2008
    Messages:
    8
    Likes Received:
    0
    I have hacked together a storage expansion system for Ubuntu, similar to the one in the default Linpus.

    Unlike the Linpus version however, it expands the whole filesystem, not just the user home folder, this means that the extra space can be used for program installation, multiple users, etc.

    Preparation

    Unlike the Linpus version, my system requires that the SD card be formatted with the ext2 filesystem (it also expects the OS to be installed on ext2).
    To do this, fire up a terminal and type:
    Code:
    sudo mkfs.ext2 /dev/mmcblk0p1
    We will also need the aufs-tools package:
    Code:
    sudo apt-get install aufs-tools
    Installation
    First download the script from here: http://www.xeonplus.net/mfh/download.php?file=609rootaufs (sorry about the sucky download system).
    Now, copy the script the the required location:
    Code:
    sudo cp /path/to/dowload /etc/initramfs-tools/scripts/init-bottom/rootaufs
    Then set the security rights:
    Code:
    sudo chown root /etc/initramfs-tools/scripts/init-bottom/rootaufs
    sudo chmod 755 /etc/initramfs-tools/scripts/init-bottom/rootaufs
    Now, since this script runs long before SD card support is normally loaded, we must change this:
    Code:
    sudo -s
    echo mmc_core >> /etc/initramfs-tools/modules
    echo mmc_block >> /etc/initramfs-tools/modules
    echo sdhci >> /etc/initramfs-tools/modules
    And, since we are using aufs:
    Code:
    echo aufs >> /etc/initramfs-tools/modules
    exit
    Finally, we must update the initramfs:
    Code:
    sudo update-initramfs -u
    Usage
    To enable the script, add "aufs=on" to the end of the "kernel" lines in /boot/grub/menu.lst by running:
    Code:
    sudo gedit /boot/grub/menu.lst
    It is probably also best to add it to the end of the #defoptions line.

    After this, reboot. When the system comes back up, check the output of:
    Code:
    cat /proc/mounts
    If you see a line like:
    Code:
    aufs /dev/.static/dev aufs rw,relatime,xino=/sd/.aufs.xino,create=mfs:30,br:/sd=rw:/ssd=rw 0 0
    Then it (probably) worked.

    The filesystem is now layed out as follows:
    • /sd - the SD card
      /ssd - the SSD
      / - the combined filesystem.
    If you ever need to edit/create files on a specific filesystem (e.g. the files in /boot should always be on the SSD) prefix the paths as above (e.g. /boot/grub/menu.lst is /ssd/boot/grub/menu.lst).

    Credits

    The script is based heavily on the one shown here: https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash
    Some additional documentation found here: http://aufs.sourceforge.net/aufs.html

    Any questions? Corrections? Problems? Improvements?
    Let me know.
     
    mallard, Aug 28, 2008
    #1
  2. mallard

    mallard

    Joined:
    Aug 26, 2008
    Messages:
    8
    Likes Received:
    0
    Whoops, have discovered that some "interesting" things happen if you boot with an SD card in the other slot!
    To prevent this, first boot up without another SD card, then:
    Code:
    ls -l /dev/disk/by-uuid/
    Will give a listing like this:
    Code:
    lrwxrwxrwx 1 root root 15 2008-08-28 22:05 e2ef0737-45d2-406a-9c6d-1136362670fd -> ../../mmcblk0p1
    lrwxrwxrwx 1 root root 10 2008-08-28 22:05 e4ed8e21-5328-4fa1-a9fe-7e59a01163fa -> ../../sda1
    Copy the UUID that points to mmcblk0p1 (e2ef0737-45d2-406a-9c6d-1136362670f in my case).

    Then edit the script (sudo gedit /etc/initramfs-tools/scripts/init-bottom/rootaufs) on line 123 change:
    Code:
    mount -t ext2 /dev/mmcblk0p1 /sd -o noatime
    to:
    Code:
    mount -t ext2 /dev/disk/by-uuid/your-uuid /sd -o noatime
    Save and quit.
    Delete the backup to avoid cluttering the initramfs, then update it:
    Code:
    sudo rm /etc/initramfs-tools/scripts/init-bottom/rootaufs~
    sudo update-initramfs -u
    If you are running an extended FS, make sure the initramfs is on the SSD by typing:
    Code:
    sudo mv /boot/initrd.img-<your-kernel-version> /ssd/boot/initrd.img-<your-kernel-version>
     
    mallard, Aug 28, 2008
    #2
  3. mallard

    jbesada

    Joined:
    Aug 18, 2008
    Messages:
    25
    Likes Received:
    0
    Will this work after suspend/resume or will it erase SDHC partitions as stock ubuntu?

    I am currently using a 16Gb SDHC as my home partition, and I cannot use suspend/resume due to this problem.
     
    jbesada, Aug 28, 2008
    #3
  4. mallard

    axcairns

    Joined:
    Aug 8, 2008
    Messages:
    92
    Likes Received:
    0
    I second this question. There was another post that recommended CONFIG_MMC_UNSAFE_RESUME=y in a custom kernel config to fix the suspend/resume. Does aufs not need this?
     
    axcairns, Sep 4, 2008
    #4
  5. mallard

    mista2

    Joined:
    Aug 26, 2008
    Messages:
    14
    Likes Received:
    0
    I see a previous poster here indicated they used a hi capacity SD card.

    Can anyone confirm that you can use SDHC cards in the card readers in the ZG5 model?
     
    mista2, Sep 11, 2008
    #5
  6. mallard

    mista2

    Joined:
    Aug 26, 2008
    Messages:
    14
    Likes Received:
    0
    To anwer my own question - yes. I just bought an 8GB SDHC and this works fine, but I have noticed the disk dissappears after suspend, and wireless fails to com back after hibernate. Oh well, it only takes about 80 seconds to boot from cold and log in anyway 8) (still longer than linpus's 15 seconds, but atleast I can install the apps I need easily in Ubuntu.
     
    mista2, Sep 11, 2008
    #6
  7. mallard

    edkmho

    Joined:
    Aug 19, 2008
    Messages:
    16
    Likes Received:
    0
    can this script be use with the latest version of Ubuntu ? Hopefully it works, so that i donot have to upgade my aa1 with a bigger SSD or modded with hard disk.

    I am going to isntall Ubuntu 8.10 UMPC version.

    Please advise, thanks.
     
    edkmho, Oct 31, 2008
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.