Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Friday, February 7, 2014

Different file size on server and local file system

I got a case when file on server (Solaris) have different size from what I have on Local PC (Ubuntu 12.04),

[user@server ~]$ du -h /var/tmp/file.csv
548K    /var/tmp/file.csv
[roman@laptop ~]$ du --apparent-size -h /var/tmp/file.csv
1.9M    /var/tmp/file.csv

[user@server ~]$ ls -lh /var/tmp/file.csv
-rw-r--r-- 1 sb sb 1.9M Feb  7 13:59 /var/tmp/file.csv
[user@server ~]$ du -h /var/tmp/file.csv
548K    /var/tmp/file.csv
[user@server ~]$ du --apparent-size -h /var/tmp/file.csv
1.9M    /var/tmp/file.csv

from man:
    --apparent-size
              print apparent sizes,  rather  than  disk  usage;  although  the
              apparent  size is usually smaller, it may be larger due to holes
              in (`sparse') files, internal  fragmentation,  indirect  blocks,
              and the like



Wednesday, October 10, 2012

Mongo: get all results to file instead of page iteration


http://www.mongodb.org/display/DOCS/Scripting+the+shell
paragraph "Differences between scripted and interactive / Printing".

connect to host:
./mongo server.com/mydb
> db.users.find()


to do the same from shell:

./mongo server.com/mydb --quiet --eval "db.users.find().forEach(printjson);" > 1.txt

Attention: for prefix ".forEach(printjson);" without it you will get error like
DBQuery: mydb.users-> undefined