I have an Ext4 partition (not auto-mounted) that I would like to share (entirely) in my home that contains Mac OSX, Windows and Linux machines (currently the most important is sharing with the Mac). How may I do this?
It could be that some process still has deleted files open. If this is the case then they will not appear in the
du output but would still be counted in the
One quick way to check for these is to list
/proc as user
sudo su should get you a root shell). Any open, but deleted files will have
(deleted) at the end of the symbolic link target name.
ls -l /proc/*/fd/* | grep deleted | grep /home
should give you a list of any files open. Once you have that then an
ls -lL of the specific file should give you the size of the file.
As an example (using
/tmp on my system because there are no examples on
/home here) I see a few files owned by user
richm@viking:/$ sudo su root@viking:/# ls -l /proc/*/fd/* | grep deleted | grep /tmp lrwx------ 1 root root 64 Oct 13 06:30 /proc/1489/fd/11 -> /tmp/ibwmCqpg (deleted) lrwx------ 1 root root 64 Oct 13 06:30 /proc/1491/fd/12 -> /tmp/ib9MTMQi (deleted) root@viking:/# ls -lL /proc/1489/fd/11 -rw------- 0 mysql2 mysql2 0 Aug 24 14:09 /proc/1489/fd/11 root@viking:/# ls -lL /proc/1491/fd/12 -rw------- 0 mysql mysql 1320 Oct 15 13:40 /proc/1491/fd/12
If you have any processes with large deleted files open then stoping the process should be enough to reclaim the disk space. Alternatively a reboot should do the same thing.
After a bit of searching, I found the solution myself:
First, I had to give myself the ownership over
/dev/sda4, and I had to give
others read and execute permission. I did that by changing the partition entry in
To do that, I had to know my
gid. So the first thing I did was writing the following command in a Terminal:
This will give an output like this:
UID=1000(myname) GID=1000(myname) groups=1000(myname),4(adm),24(cdrom), ...
So now I knew that both my
uid and my
Do you already know the name of the NTFS partition? If not, type this command in a Terminal:
and write down the NTFS partition on a piece of paper.
Now, to change the permissions, I edited
/etc/fstab with the
nano text editor. So, the next command you have to type in a terminal is:
sudo nano /etc/fstab
Go all the way down and type this line:
/dev/sda4 /media/Data ntfs defaults,umask=0022,uid=YourUIDHere,gid=YourGIDHere 0 0
(You should replace
/dev/sda4 by the NTFS partition that you wrote down earlier).
umask=0022 sets the directory's (
d) permissions permissions to
drwxr-xr-x, to make sure that the user (me) can read, write and execute (
rwx) while the
others can only read and execute (
r-x) the directory, which is what I wanted.
After that, I could mark the three checkboxes without any errors, and the folder would be shared over the network. Because I was not sure whether the sharing settings would be kept after a restart, I unchecked the checkboxes and added some lines in
/etc/samba/smb.conf instead. I did that this way:
In a terminal, I typed
sudo nano /etc/samba/smb.conf
I scrolled down to the last line, and pasted the following there:
[MyShare] comment = My Share path = /media/Data/FolderToBeShared browseable = yes guest ok = yes read only = yes create mask = 0755
I saved the file, and then rebooted. The folder was accessible from the network now.