Why is my overlayfs command not working?How to use OverlayFS to protect the root filesystem?Merge two NFS...

Determine if a triangle is equilateral, isosceles, or scalene

Moving files accidentally to an not existing directory erases files?

How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?

Passing lines from the text file of a list of files to or as arguments

Can two figures have the same area, perimeter, and same number of segments have different shape?

What to do when you reach a conclusion and find out later on that someone else already did?

Is it legal for private citizens to "impound" e-scooters?

High income, sudden windfall

What do I do when a student working in my lab "ghosts" me?

What is the life span of a Flerken?

Why are there not any MRI machines available in Interstellar?

How can I make sure my players' decisions have consequences?

kids pooling money for Lego League and taxes

Spoken encryption

Sextortion with actual password not found in leaks

How can I receive packages while in France?

Are glider winch launches rarer in the USA than in the rest of the world? Why?

Inadvertently nuked my disk permission structure - why?

How important is a good quality camera for good photography?

Why is chess failing to attract big name sponsors?

This message is flooding my syslog, how to find where it comes from?

What is a Union Word™?

Spacing setting of math mode

USA: Can a witness take the 5th to avoid perjury?



Why is my overlayfs command not working?


How to use OverlayFS to protect the root filesystem?Merge two NFS shares with OverlayFS






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















The commands below should be creating a root overlay, such that any modifications to root will appear in /tmp/upper



However as you can see it does not appear to be working. Can anyone suggest what I am doing wrong?



I am following the syntax here: https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt



thanks



ubuntu@ip-10-0-0-48:~$ sudo su
root@ip-10-0-0-48:/home/ubuntu# cd /tmp
root@ip-10-0-0-48:/tmp# mkdir upper
root@ip-10-0-0-48:/tmp# mkdir workdir
root@ip-10-0-0-48:/tmp# mount -t overlay overlay -olowerdir=/,upperdir=/tmp/upper,workdir=/tmp/workdir /
root@ip-10-0-0-48:/tmp# touch /floob
root@ip-10-0-0-48:/tmp# ls /
bin boot dev etc floob home initrd.img lib lib64 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz x
root@ip-10-0-0-48:/tmp# ls /tmp/upper/
root@ip-10-0-0-48:/tmp#









share|improve this question














bumped to the homepage by Community 39 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

    – techraf
    Dec 13 '16 at 7:40













  • @techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

    – Gilles
    Dec 13 '16 at 22:59











  • But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

    – Gilles
    Dec 13 '16 at 23:06











  • @Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

    – techraf
    Dec 13 '16 at 23:16













  • @techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

    – Gilles
    Dec 13 '16 at 23:24




















1















The commands below should be creating a root overlay, such that any modifications to root will appear in /tmp/upper



However as you can see it does not appear to be working. Can anyone suggest what I am doing wrong?



I am following the syntax here: https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt



thanks



ubuntu@ip-10-0-0-48:~$ sudo su
root@ip-10-0-0-48:/home/ubuntu# cd /tmp
root@ip-10-0-0-48:/tmp# mkdir upper
root@ip-10-0-0-48:/tmp# mkdir workdir
root@ip-10-0-0-48:/tmp# mount -t overlay overlay -olowerdir=/,upperdir=/tmp/upper,workdir=/tmp/workdir /
root@ip-10-0-0-48:/tmp# touch /floob
root@ip-10-0-0-48:/tmp# ls /
bin boot dev etc floob home initrd.img lib lib64 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz x
root@ip-10-0-0-48:/tmp# ls /tmp/upper/
root@ip-10-0-0-48:/tmp#









share|improve this question














bumped to the homepage by Community 39 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

    – techraf
    Dec 13 '16 at 7:40













  • @techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

    – Gilles
    Dec 13 '16 at 22:59











  • But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

    – Gilles
    Dec 13 '16 at 23:06











  • @Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

    – techraf
    Dec 13 '16 at 23:16













  • @techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

    – Gilles
    Dec 13 '16 at 23:24
















1












1








1








The commands below should be creating a root overlay, such that any modifications to root will appear in /tmp/upper



However as you can see it does not appear to be working. Can anyone suggest what I am doing wrong?



I am following the syntax here: https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt



thanks



ubuntu@ip-10-0-0-48:~$ sudo su
root@ip-10-0-0-48:/home/ubuntu# cd /tmp
root@ip-10-0-0-48:/tmp# mkdir upper
root@ip-10-0-0-48:/tmp# mkdir workdir
root@ip-10-0-0-48:/tmp# mount -t overlay overlay -olowerdir=/,upperdir=/tmp/upper,workdir=/tmp/workdir /
root@ip-10-0-0-48:/tmp# touch /floob
root@ip-10-0-0-48:/tmp# ls /
bin boot dev etc floob home initrd.img lib lib64 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz x
root@ip-10-0-0-48:/tmp# ls /tmp/upper/
root@ip-10-0-0-48:/tmp#









share|improve this question














The commands below should be creating a root overlay, such that any modifications to root will appear in /tmp/upper



However as you can see it does not appear to be working. Can anyone suggest what I am doing wrong?



I am following the syntax here: https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt



thanks



ubuntu@ip-10-0-0-48:~$ sudo su
root@ip-10-0-0-48:/home/ubuntu# cd /tmp
root@ip-10-0-0-48:/tmp# mkdir upper
root@ip-10-0-0-48:/tmp# mkdir workdir
root@ip-10-0-0-48:/tmp# mount -t overlay overlay -olowerdir=/,upperdir=/tmp/upper,workdir=/tmp/workdir /
root@ip-10-0-0-48:/tmp# touch /floob
root@ip-10-0-0-48:/tmp# ls /
bin boot dev etc floob home initrd.img lib lib64 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var vmlinuz x
root@ip-10-0-0-48:/tmp# ls /tmp/upper/
root@ip-10-0-0-48:/tmp#






overlayfs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 13 '16 at 3:48









Duke DougalDuke Dougal

3636 silver badges20 bronze badges




3636 silver badges20 bronze badges





bumped to the homepage by Community 39 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 39 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

    – techraf
    Dec 13 '16 at 7:40













  • @techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

    – Gilles
    Dec 13 '16 at 22:59











  • But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

    – Gilles
    Dec 13 '16 at 23:06











  • @Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

    – techraf
    Dec 13 '16 at 23:16













  • @techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

    – Gilles
    Dec 13 '16 at 23:24





















  • You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

    – techraf
    Dec 13 '16 at 7:40













  • @techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

    – Gilles
    Dec 13 '16 at 22:59











  • But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

    – Gilles
    Dec 13 '16 at 23:06











  • @Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

    – techraf
    Dec 13 '16 at 23:16













  • @techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

    – Gilles
    Dec 13 '16 at 23:24



















You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

– techraf
Dec 13 '16 at 7:40







You are asking the same question as this one. Where did you get the idea that mounting to / will succeed? Certainly not from the referenced document. You can mount elsewhere and chroot.

– techraf
Dec 13 '16 at 7:40















@techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

– Gilles
Dec 13 '16 at 22:59





@techraf You can certainly mount an overlayfs filesystem to /. It's a pretty common scenario.

– Gilles
Dec 13 '16 at 22:59













But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

– Gilles
Dec 13 '16 at 23:06





But I'm not sure if you can do it directly. You may have to mount it on a subdirectory and chroot into it. At least that's what overlayroot does.

– Gilles
Dec 13 '16 at 23:06













@Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

– techraf
Dec 13 '16 at 23:16







@Gilles Ok, so what happens to current processes, open files? They suddenly switch to the overlay-mounted root? Regarding your second comment, you are repeating my words ("month elsewhere"). I am confused now.

– techraf
Dec 13 '16 at 23:16















@techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

– Gilles
Dec 13 '16 at 23:24







@techraf Open files keep using the lower filesystem, no matter how you do it. That's why an overlay root is usually established from by the initramfs.

– Gilles
Dec 13 '16 at 23:24












1 Answer
1






active

oldest

votes


















0














In the end I just created a bunch of overlays, one for each of the top level directories that I was interested in.



The point of the exercise was to isolate changes made during package installation and this seems to do it well enough for the most part.



#/bin/bash
array=( lib home opt bin boot var etc usr srv lib64 root sbin )
mkdir -p /ovl
cd /ovl
rm -rf /ovl/overlay
rm -rf /ovl/workdir
mkdir -p /ovl/overlay
mkdir -p /ovl/workdir

for i in "${array[@]}"
do
mkdir -p /ovl/overlay/${i}
mkdir -p /ovl/workdir/${i}
mount -t overlay overlay -o lowerdir=/${i},upperdir=/ovl/overlay/${i},workdir=/ovl/workdir/${i} /${i}
done





share|improve this answer


























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f329974%2fwhy-is-my-overlayfs-command-not-working%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In the end I just created a bunch of overlays, one for each of the top level directories that I was interested in.



    The point of the exercise was to isolate changes made during package installation and this seems to do it well enough for the most part.



    #/bin/bash
    array=( lib home opt bin boot var etc usr srv lib64 root sbin )
    mkdir -p /ovl
    cd /ovl
    rm -rf /ovl/overlay
    rm -rf /ovl/workdir
    mkdir -p /ovl/overlay
    mkdir -p /ovl/workdir

    for i in "${array[@]}"
    do
    mkdir -p /ovl/overlay/${i}
    mkdir -p /ovl/workdir/${i}
    mount -t overlay overlay -o lowerdir=/${i},upperdir=/ovl/overlay/${i},workdir=/ovl/workdir/${i} /${i}
    done





    share|improve this answer




























      0














      In the end I just created a bunch of overlays, one for each of the top level directories that I was interested in.



      The point of the exercise was to isolate changes made during package installation and this seems to do it well enough for the most part.



      #/bin/bash
      array=( lib home opt bin boot var etc usr srv lib64 root sbin )
      mkdir -p /ovl
      cd /ovl
      rm -rf /ovl/overlay
      rm -rf /ovl/workdir
      mkdir -p /ovl/overlay
      mkdir -p /ovl/workdir

      for i in "${array[@]}"
      do
      mkdir -p /ovl/overlay/${i}
      mkdir -p /ovl/workdir/${i}
      mount -t overlay overlay -o lowerdir=/${i},upperdir=/ovl/overlay/${i},workdir=/ovl/workdir/${i} /${i}
      done





      share|improve this answer


























        0












        0








        0







        In the end I just created a bunch of overlays, one for each of the top level directories that I was interested in.



        The point of the exercise was to isolate changes made during package installation and this seems to do it well enough for the most part.



        #/bin/bash
        array=( lib home opt bin boot var etc usr srv lib64 root sbin )
        mkdir -p /ovl
        cd /ovl
        rm -rf /ovl/overlay
        rm -rf /ovl/workdir
        mkdir -p /ovl/overlay
        mkdir -p /ovl/workdir

        for i in "${array[@]}"
        do
        mkdir -p /ovl/overlay/${i}
        mkdir -p /ovl/workdir/${i}
        mount -t overlay overlay -o lowerdir=/${i},upperdir=/ovl/overlay/${i},workdir=/ovl/workdir/${i} /${i}
        done





        share|improve this answer













        In the end I just created a bunch of overlays, one for each of the top level directories that I was interested in.



        The point of the exercise was to isolate changes made during package installation and this seems to do it well enough for the most part.



        #/bin/bash
        array=( lib home opt bin boot var etc usr srv lib64 root sbin )
        mkdir -p /ovl
        cd /ovl
        rm -rf /ovl/overlay
        rm -rf /ovl/workdir
        mkdir -p /ovl/overlay
        mkdir -p /ovl/workdir

        for i in "${array[@]}"
        do
        mkdir -p /ovl/overlay/${i}
        mkdir -p /ovl/workdir/${i}
        mount -t overlay overlay -o lowerdir=/${i},upperdir=/ovl/overlay/${i},workdir=/ovl/workdir/${i} /${i}
        done






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 13 '16 at 23:12









        Duke DougalDuke Dougal

        3636 silver badges20 bronze badges




        3636 silver badges20 bronze badges






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f329974%2fwhy-is-my-overlayfs-command-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...