Mounted folders with bind take up space in root drive

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












A few months back, I have set up a separate storage for my data on my linux server (running Ubuntu 17.10).



The way I set it up is as follows:




  • /dev/mapper/community--vg-root - primary drive - 60GB - mapped to /


  • /dev/xvdb1 - secondary drive - 100GB - mapped to /mnt/data

then, since I know I have many apps and data in: /opt, /var, /home and /root, I decided to use mount bind option, to move all the files to the new drive on /mnt/data. My /etc/fstab looks like this:



#<file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/community--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/community--vg-swap_1 none swap sw 0 0

# data - 100GB
/dev/xvdb1 /mnt/data ext4 defaults 0 1
/var /mnt/data/var none defaults,bind 0 0
/opt /mnt/data/opt none defaults,bind 0 0
/home /mnt/data/home none defaults,bind 0 0
/root /mnt/data/root none defaults,bind 0 0


The problem



Using df -h I get:



/dev/mapper/community--vg-root 53G 16G 35G 32% /
/dev/xvdb1 98G 61M 93G 1% /mnt/data


But using du -h in /mnt/data I get:



14G .


So I definitely know that my binds and mounting is working, but all the data still takes up space in root.



All data has been moved from primary to the secondary drive, and then mounted. So there is no data in /var, /opt, /root, /home on the primary drive.



Once I even had to remove some files, because the system was unresponsive due to log files taking up all the space in root (which they can't, because they are on a different hard drive).



Is there any way to solve this problem? The reason why I added a second drive was to prevent the root drive from being full and moving my precious data to another drive which was only for data.







share|improve this question

















  • 2




    If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
    – Rui F Ribeiro
    Jul 19 at 5:18










  • @RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
    – Sonic656
    Jul 19 at 6:39











  • Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
    – AlexP
    Jul 19 at 8:43










  • @AlexP You're right, I think I messed it up. Thank you for your help!
    – Sonic656
    Jul 20 at 7:48
















up vote
0
down vote

favorite












A few months back, I have set up a separate storage for my data on my linux server (running Ubuntu 17.10).



The way I set it up is as follows:




  • /dev/mapper/community--vg-root - primary drive - 60GB - mapped to /


  • /dev/xvdb1 - secondary drive - 100GB - mapped to /mnt/data

then, since I know I have many apps and data in: /opt, /var, /home and /root, I decided to use mount bind option, to move all the files to the new drive on /mnt/data. My /etc/fstab looks like this:



#<file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/community--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/community--vg-swap_1 none swap sw 0 0

# data - 100GB
/dev/xvdb1 /mnt/data ext4 defaults 0 1
/var /mnt/data/var none defaults,bind 0 0
/opt /mnt/data/opt none defaults,bind 0 0
/home /mnt/data/home none defaults,bind 0 0
/root /mnt/data/root none defaults,bind 0 0


The problem



Using df -h I get:



/dev/mapper/community--vg-root 53G 16G 35G 32% /
/dev/xvdb1 98G 61M 93G 1% /mnt/data


But using du -h in /mnt/data I get:



14G .


So I definitely know that my binds and mounting is working, but all the data still takes up space in root.



All data has been moved from primary to the secondary drive, and then mounted. So there is no data in /var, /opt, /root, /home on the primary drive.



Once I even had to remove some files, because the system was unresponsive due to log files taking up all the space in root (which they can't, because they are on a different hard drive).



Is there any way to solve this problem? The reason why I added a second drive was to prevent the root drive from being full and moving my precious data to another drive which was only for data.







share|improve this question

















  • 2




    If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
    – Rui F Ribeiro
    Jul 19 at 5:18










  • @RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
    – Sonic656
    Jul 19 at 6:39











  • Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
    – AlexP
    Jul 19 at 8:43










  • @AlexP You're right, I think I messed it up. Thank you for your help!
    – Sonic656
    Jul 20 at 7:48












up vote
0
down vote

favorite









up vote
0
down vote

favorite











A few months back, I have set up a separate storage for my data on my linux server (running Ubuntu 17.10).



The way I set it up is as follows:




  • /dev/mapper/community--vg-root - primary drive - 60GB - mapped to /


  • /dev/xvdb1 - secondary drive - 100GB - mapped to /mnt/data

then, since I know I have many apps and data in: /opt, /var, /home and /root, I decided to use mount bind option, to move all the files to the new drive on /mnt/data. My /etc/fstab looks like this:



#<file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/community--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/community--vg-swap_1 none swap sw 0 0

# data - 100GB
/dev/xvdb1 /mnt/data ext4 defaults 0 1
/var /mnt/data/var none defaults,bind 0 0
/opt /mnt/data/opt none defaults,bind 0 0
/home /mnt/data/home none defaults,bind 0 0
/root /mnt/data/root none defaults,bind 0 0


The problem



Using df -h I get:



/dev/mapper/community--vg-root 53G 16G 35G 32% /
/dev/xvdb1 98G 61M 93G 1% /mnt/data


But using du -h in /mnt/data I get:



14G .


So I definitely know that my binds and mounting is working, but all the data still takes up space in root.



All data has been moved from primary to the secondary drive, and then mounted. So there is no data in /var, /opt, /root, /home on the primary drive.



Once I even had to remove some files, because the system was unresponsive due to log files taking up all the space in root (which they can't, because they are on a different hard drive).



Is there any way to solve this problem? The reason why I added a second drive was to prevent the root drive from being full and moving my precious data to another drive which was only for data.







share|improve this question













A few months back, I have set up a separate storage for my data on my linux server (running Ubuntu 17.10).



The way I set it up is as follows:




  • /dev/mapper/community--vg-root - primary drive - 60GB - mapped to /


  • /dev/xvdb1 - secondary drive - 100GB - mapped to /mnt/data

then, since I know I have many apps and data in: /opt, /var, /home and /root, I decided to use mount bind option, to move all the files to the new drive on /mnt/data. My /etc/fstab looks like this:



#<file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/community--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/community--vg-swap_1 none swap sw 0 0

# data - 100GB
/dev/xvdb1 /mnt/data ext4 defaults 0 1
/var /mnt/data/var none defaults,bind 0 0
/opt /mnt/data/opt none defaults,bind 0 0
/home /mnt/data/home none defaults,bind 0 0
/root /mnt/data/root none defaults,bind 0 0


The problem



Using df -h I get:



/dev/mapper/community--vg-root 53G 16G 35G 32% /
/dev/xvdb1 98G 61M 93G 1% /mnt/data


But using du -h in /mnt/data I get:



14G .


So I definitely know that my binds and mounting is working, but all the data still takes up space in root.



All data has been moved from primary to the secondary drive, and then mounted. So there is no data in /var, /opt, /root, /home on the primary drive.



Once I even had to remove some files, because the system was unresponsive due to log files taking up all the space in root (which they can't, because they are on a different hard drive).



Is there any way to solve this problem? The reason why I added a second drive was to prevent the root drive from being full and moving my precious data to another drive which was only for data.









share|improve this question












share|improve this question




share|improve this question








edited Jul 19 at 6:52
























asked Jul 19 at 5:14









Sonic656

12




12







  • 2




    If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
    – Rui F Ribeiro
    Jul 19 at 5:18










  • @RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
    – Sonic656
    Jul 19 at 6:39











  • Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
    – AlexP
    Jul 19 at 8:43










  • @AlexP You're right, I think I messed it up. Thank you for your help!
    – Sonic656
    Jul 20 at 7:48












  • 2




    If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
    – Rui F Ribeiro
    Jul 19 at 5:18










  • @RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
    – Sonic656
    Jul 19 at 6:39











  • Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
    – AlexP
    Jul 19 at 8:43










  • @AlexP You're right, I think I messed it up. Thank you for your help!
    – Sonic656
    Jul 20 at 7:48







2




2




If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
– Rui F Ribeiro
Jul 19 at 5:18




If you mount dirs on top of directory structures with data, the data won´t disappear by itself.
– Rui F Ribeiro
Jul 19 at 5:18












@RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
– Sonic656
Jul 19 at 6:39





@RuiFRibeiro I moved all the data to the actual new drive and mounted it to /mnt/data, after that, I mounted the folders with bind option
– Sonic656
Jul 19 at 6:39













Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
– AlexP
Jul 19 at 8:43




Are you sure that you are binding in the right direction? You are mounting for example /opt to /mnt/data/opt. From the text of the question my impression was that you wanted to mount /mnt/data/opt on /opt.
– AlexP
Jul 19 at 8:43












@AlexP You're right, I think I messed it up. Thank you for your help!
– Sonic656
Jul 20 at 7:48




@AlexP You're right, I think I messed it up. Thank you for your help!
– Sonic656
Jul 20 at 7:48















active

oldest

votes











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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f457125%2fmounted-folders-with-bind-take-up-space-in-root-drive%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457125%2fmounted-folders-with-bind-take-up-space-in-root-drive%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay