5

I'm trying to add lines to my /etc/fstab file. but the lines I add get cleared on reboot because I am using a persistent live USB stick.

I don't want a lecture. I just want to know which file writes the /etc/fstab file at restart and I want to alter that file so that I can auto mount the disk I want.

So this is not really a question but more like a request.

I am requesting the location of the file/files that are responsible for writing to or resetting /etc/fstab on restart.

10
  • I was able to add the line "gksu mount /dev/sda2 /media/Windows" to my startup apps program and it seems to work fine but I still wish I could get fstab working. Aug 11, 2011 at 19:26
  • Are you sure it is reset, and not just ignored? I would think it would just be ignored, because the new version saved in the persistence file is not used until after the original fstab is processed.
    – psusi
    Aug 11, 2011 at 19:30
  • Maybe you will have to make a customized live-usb. See this: forums.debian.net/viewtopic.php?f=17&t=59876
    – desgua
    Aug 12, 2011 at 0:11
  • @psusi, nope, not ignored because when I reboot I reopen fstab and the line I entered is gone. Aug 12, 2011 at 11:07
  • this is amazing that a simple file that resets the fstab can't be found O_o it has to be just a simple shell script somewhere. Aug 13, 2011 at 13:03

3 Answers 3

4

For my LiveUSB install with Ubuntu 11.10 (which has a casper-rw persistence loopback file), the file that worked for me to have drives mounted automatically is:

/usr/share/initramfs-tools/scripts/casper-bottom/12fstab

I added lines into that script which worked to add new drive mounts upon boot-up. The odd thing is that my /etc/fstab file does NOT reflect the drive mounts. This would seem to suggest that the /etc/fstab file is just a dummy file or something to the LiveCD setups. Not sure, but changes added to the 12fstab file DO persist.

2
  • This seems to be outdated. Well at least it didn't work for me. I added a line to /etc/fstab of my live system and tested it with sudo mount -a. It worked. Then I added the same line at the appropriate place in /usr/share/initramfs-tools/scripts/casper-bottom/12fstab and rebooted. No effect. Might be that the mount point was bad or something - need to test that.
    – con-f-use
    Aug 28, 2012 at 12:02
  • fstab confirmed still being overwritten after changing 12fstab and running update-initramfs -u. used rc.local and it worked. But now I have the issue of not being able to change my root mount properties to account for my horribly slow usb flash drive performance.
    – parity3
    Apr 24, 2020 at 22:40
1

Add your mount commands in /etc/rc.local

...
mount -t ntfs-3g -L Inter /media/Inter -o uid=1000,gid=999,umask=002
exit
0

Rather than use a live media with persistence, I always simply install directly to the flash drive. This way any changes I make are kept. Whether the changes are to the data stored there or the system configuration or applications I have installed is irrelevant with this approach. If you still need the live media for installation purposes you can put a copy of the ISO on the stick and boot it as needed as outlined here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .