Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: aufs root filesystem

  1. #1
    Join Date
    Jul 2008
    Beans
    3

    aufs root filesystem

    Hello Everyone,
    I'm new here to the forums, bat have like a 5 year on and off experience with linux. First years mostly debian until I discovered Ubuntu, really think it's a wonderfull OS!

    But i have a problem,

    I Have Ubuntu installed on my eeepc 900, with 2gb of ram.
    /dev/sda1 is the 4gb disk where ubuntu lives
    /dev/sdb1 is the 16gb disk where my home dir lives
    I have no swap or boot partition, which is working fine for as long as i worked with it

    I read this article
    http://help.ubuntu.com/community/auf...stemOnUsbFlash
    on how to reduce writes on my flashdisk.

    I pretty much have everything configured and installed how i wanted, so i thought it might be a good idea to 'freeze' my installation like this.

    I followed every step of the tutorial and even added 'A nicer solution to add the kernel entries'.
    But after rebooting
    - I get a lot of error messages of scripts and files that are not found
    - /dev/sdb1 is not mounted (so no /home dirs)
    - X isn't started (probably in the not found files somewhere)

    When I alt+f1 to the first terminal it says in the top of the screen

    Code:
    aufs setup on /root
    
    sed: no previous regexp.
    
    ubuntu 8.04.1 binkeee tty1
    the "aufs setup on /root" is a message from the rootaufs script on the page mentioned earlier.
    So the script get started, but then sed gives an error. since i have no experience with sed i don't know what the message means (also couldn't really find it so far) nor do i know if one of the sed commands is wrong.

    forthermore;

    on the alt+f8 'status console' if i can call it that. there's mentioned
    Code:
    * Mounting local filesystems...
    mount: /dev/sda1 already mounted or /ro busy
       ...fail!
    when i execute the 'df' command i can see that
    /dev/sda1 is mounted on /ro
    aufs is mounted on /
    aufs-tmpfs is mounted on /rw

    I'm not quite sure what is causing this, i can still boot without the aufs rootfs and then everything is working again, but i would like to get it to work with the aufs rootfs

    any help would be greatly appreciated, also if there is a way how i can achieve the same on a different way

    tested with kernels:
    2.6.24-16-generic
    2.6.24-19-eeepc
    both with the exact same result

    Kind Regards,

    Mannes Brak
    Last edited by Mannes; July 9th, 2008 at 01:44 AM.

  2. #2
    Join Date
    Jul 2008
    Beans
    3

    Re: aufs root filesystem

    Hello again,

    I've done some further research in this matter and I think I've located the problem.

    The rootaufs script overwrites the standard fstab file so that all my other fstab entries get ignored.
    This explains all the files not found because my /usr is in a squashfs/unionfs construction which doesn't get mounted,
    just like my /home which is on my /dev/sdb1.

    can someone help me out with rewriting the script so that it also mounts my other filesystems? since i still have no experience with those sed statements i don't know how to change them

    any help would again be greatly appreciated!

  3. #3
    Join Date
    Oct 2007
    Beans
    5

    Re: aufs root filesystem

    Thank you for your help.
    Please change the title of "A nicer solution to add the kernel entries" to "Make Grub Menu changes persistent " or "Make Grub Menu changes Permanent"

    We need to add a credits section.

    I'm going to work on this project for ohio linux fest 2008. I think this can be made into a script. I will retest and add the sed script for fstab.

    sudo sed -i s/'defoptions=quiet splash'/'defoptions=quiet splash aufs=tmpfs'/g /boot/grub/menu.lst

    I'll look at the rest of the section to see about a sed one liners.

    Send me your fstab. I'm new to sed as well. It's just so fast to make one liner changes.
    I will have to review my notes. I need to edit fstab to keep the mounts in line. Without the changes df or mount report the wrong information.

    My personal goal is to keep everything on one disk. Aufs has on option to copy up or merge the changes. I want to build this into an update/sync command. If you like your changes run the update else put the drive in rw mode and copy your files to the (base) normally ro dir. It might be nice to have a dir like ~/Documents/ mounted rw with noatime. In my opinion all writes have some risk.

    Life and death on flash.

    As a side note, I just lost a flash dive on my phone. I'm not sure what the "real recovery" software can do but it looks gone to me. I assume all flash drive will fail and I will never get anything off of the disk.

    Thank you for the feed back. I will have time to work on this on Monday night. Talk to later, Nick

  4. #4
    Join Date
    Jul 2008
    Beans
    3

    Re: aufs root filesystem

    here is my fstab

    Code:
    # /etc/fstab: static file system information.
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    defaults        0       0
    # /dev/sda2
    UUID=9f82a725-2797-41ee-a4e5-507a24941b86 /               ext2    noatime,errors=remount-ro 0       1
    # /dev/sda1
    UUID=a154b93d-6156-4f6e-8cf6-840fad676ea2 /boot           ext2    noatime        0       2
    # /dev/sdb1
    UUID=e646edf4-f7a2-4647-a6db-8af8c99e761a /home           ext2    noatime        0       2
    
    #mount tmp dirs in ram memory, to reduce writes
    tmpfs		/tmp		tmpfs	defaults,noatime,mode=0777	0	0
    tmpfs		/var/tmp	tmpfs	defaults,noatime,mode=0777	0	0
    tmpfs		/var/log	tmpfs	defaults,noatime,mode=0777	0	0
    
    #mount the squashfs /usr directory and put a writable layer on top
    /.filesystem/usr/usr.sqfs /usr squashfs ro,loop,nodev 0 0
    unionfs /usr unionfs nodev,noatime,dirs=/.filesystem/usr/overlay=rw:/usr=ro 0 0
    I would like to keep my home dir writeable, because that's where i download files and edit my documents. And this is something i would like to keep doing

    maybe you can let this depend on a var in the script? writablehome=1 for example

    maybe i could change my fstab to let my /usr dir make use of the aufs filesystem as well instead of unionfs

  5. #5
    Join Date
    Oct 2006
    Beans
    14

    Re: aufs root filesystem

    Quote Originally Posted by Mannes View Post
    Hello again,

    I've done some further research in this matter and I think I've located the problem.

    The rootaufs script overwrites the standard fstab file so that all my other fstab entries get ignored.
    This explains all the files not found because my /usr is in a squashfs/unionfs construction which doesn't get mounted,
    just like my /home which is on my /dev/sdb1.

    can someone help me out with rewriting the script so that it also mounts my other filesystems? since i still have no experience with those sed statements i don't know how to change them

    any help would again be greatly appreciated!

    Hello,

    The sed statement is wrong. That sed statement suppose to comment out the root partition but since it is not well written it just pops out with an error thus rewriting current fstab with no input (wiping it).

    In this case sed statement would be a little bit more difficult to make since ROOTNAME variable consists of at least two slashes and slash is somehow sacred string to sed.

    I would rather go with grep instead of sed:

    Code:
    grep -v $ROOTNAME /aufs/ro/etc/fstab > /aufs/etc/fstab
    ...that would strip fstab off of root partition. I would also comment out those three lines where new root partition is constructed and written back to /aufs/etc/fstab. You are getting:

    Code:
    mount: /dev/sda1 already mounted or /ro busy
    ...because script is trying to mount root partition (new one from fstab) that was already mounted.

    Regards,

    Blaz

  6. #6
    Join Date
    Oct 2007
    Beans
    5

    Re: aufs root filesystem

    I wrote this to solve a problem that I was having with the eeepc, it needs work.

    I just working through the install of 8.4.1. I'm going to have to build a test system that I can use to rebuild the howto faster. It takes to long to install and test on my eeepc 701.

    It will take a few days for me to review how the real init scripts handle fstab. As Blaz pointed out, my sed needs work. I'm not sure grep will have the power needed to edit the files. I'm not a very good sed programmer, but sed is included in the initrd image. I'm trying to keep the changes need as small as I can.

    That said, I will continue to look into your issue. I may need to rewrite the howto. Thank you for adding your section. I like to know why things work the way they do.

    Do you think we should have the script make the changes to the menu.lst the first time it is run?

    The main part of your issue is fstab on the aufs root needs to match the real fstab on the device.

    This was short sighted of me. The general case would need to assume that this is in a server env with 200 disk in the box. Yes, I can see the need to have fstab on aufs to match the real root fstab and to have uuid support.

    In your last posts, you touched on something I wanted to mention, flash dies. I'm a skeptic, every flash drive that I have put under rw for general use has failed badly. The last one burned out in my cell phone after I took a picture. I believe that putting your home dir on a rw flash disk is a bad idea. I think it would be better to use the system in a ro mode. your changes are store in ram on /rw. A script can run remountrw and copy the data from /rw to /ro. I find I only rsync my home account after I make a major change to something. Most of the time I copy one or two file to flash. I almost never use the internal /dev/sda for fear that I'm going to burn it out. I wish sda was just a socketed sdhc card.

    Let's hear from the community, has anyone else had bad luck with Flash drives.

    Nicholas A, Schembri State College PA USA

    Note: I have only used ext2, ext3 and fat32 file systems on my flash devices.

  7. #7
    Join Date
    Oct 2006
    Beans
    14

    Re: aufs root filesystem

    Quote Originally Posted by nschembr View Post
    I'm not sure grep will have the power needed to edit the files. I'm not a very good sed programmer, but sed is included in the initrd image. I'm trying to keep the changes need as small as I can.
    What power do you need grep is part of standard UNIX tools and is widely used everywhere.

    Your script works if you use UUID= or LABEL= as value of 'root' boot parameter but it breaks if you use actual device names like /dev/sda1.

    I use grep like I mentioned and it works. I also have writable home partition on my CF card and it mounts just fine.

    Do you think we should have the script make the changes to the menu.lst the first time it is run?
    Why would one want that? I have separate boot partition which is not even mounted at boot time. If someone uses syslinux or any other bootloader instead of grub, changing menu.lst doesn't make any sense. That should be part of some other script/hook.

  8. #8
    Join Date
    Oct 2007
    Beans
    5

    Re: aufs root filesystem

    BlaY0, you are correct. Grep is the simplest and best way to edit out / and swap.

    I feel the user should see the the same fstab in both /ro/etc/fstab and /etc/fstab. This is to hard to code for this project.

    I used your example and ripped all ' / ' and swap lines from /ro/etc/fstab.

    Thank you for pointing out the error in sed. You saved me a lot of time with your bug report.


    Mannes, I'm sorry for the delay. The new script should correct you errors.

    Nicholas A. Schembri State College PA USA

    PS. I'm going to Ohio LinuxFest 2008 October 11, 2008

  9. #9
    Join Date
    Jan 2006
    Location
    Tulsa, OK
    Beans
    485
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: aufs root filesystem

    Has anyone used this with Intrepid?

    I'm trying to do something similar, and get an error that aufs cannot load. I'm wondering if it's in my implementation, or if there's something wrong with Intrepid's aufs that won't let it load from the init-ramdisk.

    [Edit]
    Never mind, the problem was in my own implementation. I was building the initrd by hand, and had neglected to import some files essential for using aufs. Adding "aufs" to the modules file and running update-initramfs -u revealed which files I was missing.
    Last edited by AusIV4; November 14th, 2008 at 09:51 PM. Reason: Solved

  10. #10
    Join Date
    Dec 2005
    Location
    New York, NY
    Beans
    10
    Distro
    Ubuntu 6.10 Edgy

    Re: aufs root filesystem

    It's been a while since traffic in this thread, but I thought I'd ask a question...

    This seems to be a pretty elegant solution, but what about integrating it in with runlevels?

    It seems that most systems just use two (1 and 2). What if we used runlevel 3 as read-only with volatile changes, and runlevel 2 as full-on rw mode. This would allow one to switch into rw mode, do an aptitude upgrade, and then switch back, without having to reboot and select the grub option.

    When there's a shutdown, things could sync, too, of course, but that's another discussion. I suppose some people might like the changes to be wiped, others would want them sync'd.

    Thoughts?

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •