LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2014, 04:54 PM   #1
BeachHead
LQ Newbie
 
Registered: May 2012
Location: Germany
Distribution: Arch, AOSP
Posts: 24

Rep: Reputation: 2
Put 'partition free space' value into file on CIFS share


Hallo,
i have a debian based internet router running on a 16GB CompactFlash Card. It contains a 15GB partition for CIFS that gets accessed by windows systems.

The problem is i don't see (on the windows client side) how much space is left on the share so i thought about creating a file on the share that always includes the free space value by creating a cron job that updates that file every second or so but i guess it would be much better if it only gets updated after actual I/O writes.

Any ideas how to do that in bash?

Additionally, i once stumbled upon some kind of 'mini http server' with curl, wget or something. But i can't remember anymore. Getting the 'free space' by http would be nice as well.

Any ideas about that?

Last edited by BeachHead; 02-05-2014 at 04:56 PM.
 
Old 02-06-2014, 11:21 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by BeachHead View Post
i have a debian based internet router running on a 16GB CompactFlash Card. It contains a 15GB partition for CIFS that gets accessed by windows systems.

The problem is i don't see (on the windows client side) how much space is left on the share
you don't?? Usually Windows Explorer displays the free capacity of a partition in the status line, or in the properties dialog.
However, it does that only if the network share is mapped to a drive letter. But that's a flaw of Windows.

Quote:
Originally Posted by BeachHead View Post
so i thought about creating a file on the share that always includes the free space value by creating a cron job that updates that file every second or so but i guess it would be much better if it only gets updated after actual I/O writes.
Apart from creating additional CPU load on the small box, that would mean duplicating a feature on application level which is already available on the protocol level.

Quote:
Originally Posted by BeachHead View Post
Any ideas how to do that in bash?
You get the total/used/available capacity of a mounted file system with 'df'. Probably have to 'grep' or 'awk' a little bit on the output to extract the information you want, or leave the output of 'df' as it is.

Quote:
Originally Posted by BeachHead View Post
Additionally, i once stumbled upon some kind of 'mini http server' with curl, wget or something. But i can't remember anymore. Getting the 'free space' by http would be nice as well.
You're really going around in circles to re-invent the wheel. Btw, curl and wget are client-side components. I can't imagine how you could get them to act as a server. But there are quite a few light HTTP servers available for Linux.

[X] Doc CPU
 
Old 02-06-2014, 12:33 PM   #3
BeachHead
LQ Newbie
 
Registered: May 2012
Location: Germany
Distribution: Arch, AOSP
Posts: 24

Original Poster
Rep: Reputation: 2
Even though curl and wget can send raw http requests it is ncat i was actually searching for. It can listen on a port and send back the free space value. That's what i meant by simple httpd.

Regarding the 'free space' solution i'm currently looking into a wear-level friendly method. To place a file into ramdisk and use its name as descriptor like '200MB free'. That file should be linked to a file in the CIFS share in a way it also reflects/links the filename so there should be no I/O writes on the CompactFlash card but i'm not sure if ext4 supports that at all (having two files linked in a way that renaming one leads to renaming the 2nd as well).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
partition space and disk space usage and free don't match nsic Linux - Newbie 3 02-22-2013 12:57 PM
[SOLVED] CIFS share on old WinNT host - smbclient works, mount -t cifs doesn't Electrode Linux - Networking 4 04-19-2012 09:11 AM
Not accepting the encryped file in fstab to mount win.. share through cifs raju.muppana Linux - Networking 3 06-25-2010 10:58 AM
Why cifs can't see the windows share file? KFC123 Linux - Networking 4 06-23-2009 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration