Hi everyone,
I recently experienced a strange behaviour with my mounted network folders and I hope someone here can explain me what is happening and why.
I successfully set up fstab to automatically mount 4 folders that are located on my WD MycloudMirror NAS. So far so good. Aside from a few permission issues things seemed to work fine, and I used Freefilesync to synchronize these folders with my home folders, as there are two different PC storing data on the NAS, a Windows PC and a Notebook running Linux Mint 18.3.
After a few days I got a warning, 0 bytes free on my harddisk, and I could not even log in anymore. I started the system with a boot stick and found out, that in the folders that are supposed to be the mount locations for the network folders, almost all the data of my local home folders was stored as well, almost doubling the data on my harddrive, which of course led to my harddisk becoming full in no time.
After deleting the data there Mint 18.3 worked fine again.
My question now is, why is this happening? Why is data that is supposed to be stored in network folders, also being stored locally in these folders? There rather should be a warning that the network drives are not available if there is no connection to the NAS.
How do I have to mount network folders so that they are not using local disk space?
Thank you for any help
Alyana
[Solved] Mounted Network folders are filling up local diskspace?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[Solved] Mounted Network folders are filling up local diskspace?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Mounted Network folders are filling up local diskspace?
Alyana,
Evidently the partition did not mount and therefore the folder you're using as a mountpoint ended up as a normal folder in /.
You can check if the there is a partition mounted with
Evidently the partition did not mount and therefore the folder you're using as a mountpoint ended up as a normal folder in /.
You can check if the there is a partition mounted with
mountpoint
or ls
which will show a lost+found/ folder Re: Mounted Network folders are filling up local diskspace?
Thank you WharfRat for this information!
That was indeed the case, because I had no connection for a few days and the data was stored in these folders nevertheless, but like you said, obviously as normal folders.
Could you or someone else please explain to me in short, how I could prevent mountpoints from being used as normal folders then, in case there is no connection?
I mean, I have to create those directories with mkdir before being able to mount at all, but then these folders remain after disconnecting. But when starting my notebook next time without network connection, these folders are still present and might be used as normal folders again? I would rather want it to behave like disconnected windows network shares that are visible but with a red sign and refusing the connection when clicking on them.
Thank you and sorry for the maybe a bit newbie question but that is something I haven't figured out yet.
That was indeed the case, because I had no connection for a few days and the data was stored in these folders nevertheless, but like you said, obviously as normal folders.
Could you or someone else please explain to me in short, how I could prevent mountpoints from being used as normal folders then, in case there is no connection?
I mean, I have to create those directories with mkdir before being able to mount at all, but then these folders remain after disconnecting. But when starting my notebook next time without network connection, these folders are still present and might be used as normal folders again? I would rather want it to behave like disconnected windows network shares that are visible but with a red sign and refusing the connection when clicking on them.
Thank you and sorry for the maybe a bit newbie question but that is something I haven't figured out yet.
Re: Mounted Network folders are filling up local diskspace?
An easy solution is to use a simple script like this to check the status of your mountpoint before syncing your files:
Naturally you would change /media/shared to your mountpoint
Code: Select all
#!/bin/bash
#
# check_mnt script to ensure a partition is mounted to /media/shared
mountpoint /media/shared >/dev/null 2>&1
if ! [ $? -eq 0 ];then
echo "Nothing is mounted to /media/shared !"
exit $?
fi
#
# continue your stuff here
exit 0
Re: Mounted Network folders are filling up local diskspace?
Great thank you so much!
Is this a common behaviour in Linux that mountpoints that are not connected are being used as local folders instead while the NAS folders are offline? And if files are being copied into such a folder, what happens when the connection is back up? I mean, some of the files might be double then, some might be missing or some files might be changed compared to the versions on the NAS.
How can it be determined then, which of the files that I see in that folder then, are the offline ones and the online ones?
Is this a common behaviour in Linux that mountpoints that are not connected are being used as local folders instead while the NAS folders are offline? And if files are being copied into such a folder, what happens when the connection is back up? I mean, some of the files might be double then, some might be missing or some files might be changed compared to the versions on the NAS.
How can it be determined then, which of the files that I see in that folder then, are the offline ones and the online ones?
Re: Mounted Network folders are filling up local diskspace?
Yes, because a mountpoint is nothing more than a local folder.
Then the files on that filesystem will be accessed.And if files are being copied into such a folder, what happens when the connection is back up?
You can use mountpoint or mount or df to check if a filesystem is mounted to that folder, as an example:How can it be determined then, which of the files that I see in that folder then, are the offline ones and the online ones?
Code: Select all
[bill@XPS] ~ $ df|grep -w shared
/dev/sda9 ext4 2.7T 1.8T 710G 72% /media/shared
[bill@XPS] ~ $ mount|grep -w shared
/dev/sda9 on /media/shared type ext4 (rw,nosuid,nodev,noexec,noatime,errors=remount-ro,data=ordered,user)
[bill@XPS] ~ $ mountpoint /media/shared
/media/shared is a mountpoint
[bill@XPS] ~ $ sudo umount /media/shared
[bill@XPS] ~ $ df|grep -w shared
[bill@XPS] ~ $ mount|grep -w shared
[bill@XPS] ~ $ mountpoint /media/shared
/media/shared is not a mountpoint
[bill@XPS] ~ $
Not to confuse you, but your root file system is a mountpoint - you can see it with
mountpoint /
Re: Mounted Network folders are filling up local diskspace?
Thank you so very much, WharfRat. Now a lot of things are a lot more transparent to me
To make sure that I understood it right:
To make sure that I understood it right:
Does that mean, that if there are some local files in such a mounted network folder, that they are displayed when the connection to the network resource is offline, and are not visible and therefore not usable when the connection is back up, and then the network folder is shown instead?And if files are being copied into such a folder, what happens when the connection is back up?
Then the files on that filesystem will be accessed.
Re: Mounted Network folders are filling up local diskspace?
You almost got itAlyana wrote: ⤴Fri Mar 16, 2018 4:10 am Does that mean, that if there are some local files in such a mounted network folder, that they are displayed when the connection to the network resource is offline, and are not visible and therefore not usable when the connection is back up, and then the network folder is shown instead?
It's not the network folder being shown when a partition's filesystem is mounted to it, it's the filesystem's contents.
When a folder isn't mounted then it's the native filesystem's content.
Normally you would not store any files to a folder intended to be used as a mountpoint as they would not be accessible when a filesystem is mounted to it,
The concept of mounting filesystems is to provide for a seamless way to integrate external media of different filesystem types like usb drives, flash drives etc. into the linux filesystem hierarchy.
File system types can be seen with
ls /lib/modules/$(uname -r)/kernel/fs
Also check out
man hier
for an explanation of the linux file tree Re: Mounted Network folders are filling up local diskspace?
Thank you very very much WharfRat!
This has really shed some light on this for me
This has really shed some light on this for me