Results 1 to 4 of 4

Thread: Script edit fstab ?

  1. #1
    Join Date
    Nov 2011
    Beans
    15

    Script edit fstab ?

    I want to run the script edit content of fstab file and run at boot time, i want to delete these text "errors = remount-ro" where UUID, instead of "ro" and add some line to the bottom , ex: "tmpfs / home tmpfs defaults, siz = xyz 0 0 ". The reason that I created iso file setup ubuntu running on ramdisk by remastersys, however it is not saved fstab file, so I want to write script to edit it, but i dont's master script , so can someone help me?

  2. #2
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Script edit fstab ?

    I use separate data partitions and install/reinstall often to test. # are my own comments on planned improvements or old versions of stuff. You will als

    This is my script as my data partitions UUIDs do not change even though the installs UUID is new. The mounts I have already created.

    Code:
    #!/bin/bash
    # make mount points for other partitions
    echo $USER
    mkdir /mnt/cdrive
    #mkdir /mnt/backup
    
    # windows shared NTFS
    mkdir /mnt/shared
    chown $USER:$USER /mnt/shared
    chmod 777 /mnt/shared
    mkdir /mnt/data
    chown $USER:$USER /mnt/data
    chmod 777 /mnt/data
    #The big "X" will also not make files executable unless they were executable to begin with.Morbius1
    #sudo chmod -R a+rwX /mnt/data
    
    # edit fstab to add mounts, UUIDs of data partitions do not change
    cp /etc/fstab /etc/fstab.backup
    #Edit fstab first Need to change from UUID to labels, so it works on both portable & DT
    str1="# Entry for /dev/sdc6 :"
    str2="UUID=a55e6335-616f-4b10-9923-e963559f2b05  /mnt/data    ext3         auto,users,rw,relatime               0  2  "
    str3="# Entry for /dev/sda1 :"
    str4="UUID=04B05B70B05B6768                      /mnt/cdrive           ntfs-3g   defaults,uid=1000,nls=utf8,windows_names   0  0  "
    str5="# Entry for /dev/sdc2 :"
    str6="UUID=44332FD360AA9657                      /mnt/shared  ntfs-3g   defaults,uid=1000,nls=utf8,windows_names   0  0  "
    fname=/etc/fstab
    echo $str1 >> $fname
    echo $str2 >> $fname
    echo $str3 >> $fname
    echo $str4 >> $fname
    echo $str5 >> $fname
    echo $str6 >> $fname
    
    # Verify no errors in fstab & remount with new mounts
    mount -a
    Last edited by oldfred; December 8th, 2011 at 06:14 AM.
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.




  3. #3
    Join Date
    Nov 2011
    Beans
    15

    Re: Script edit fstab ?

    I've been edited fstab susessfull (echo "tmpfs /home tmpfs defaults,siz=xyz 0 0" | sudo tee -a /etc/fstab). The next step i want to run it auto when the first time boot after install. But how can i run script before fstab load??? it's so difficult

  4. #4
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Script edit fstab ?

    You just need to run it, even after fstab loads as the mount -a reloads the fstab file.
    I am not familiar with where in the startup process you have to put it, but have seen several posts discussing that issue.

    Looks like: /etc/rc.local
    http://ubuntuforums.org/showthread.php?t=1531030
    http://ubuntuforums.org/showthread.php?t=1046139
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.




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
  •