Newbie questions on file system (/ipfs/ls, /ipfs/file, /ipfs/files, mutable, and /firestore)

Hello,
Newbie questions on the file system after trying IPFS - sorry too many Qs within one post:

  • mutable file system and linux file system
    are they the same ?

  • mutable file system and network storage
    is it correct that the files I added to my local mutable file system is only uploaded to a remote machine if the file is accessed by the remote machine ?

  • mutable file system and file hash
    if I use /ipfs/files/write to the same path with the same file name, is a new hash created everytime ? how do I get back the earlier version ?

  • in the network, is the file sharded ?
    if so, what’s the algorithm to determine how the file is sharded ?

  • /ls, /file/ls, and /files/ls commands
    are these listing different info about different file systems ?

  • /refs/local and the ls commands above
    why the default files are only listed with /refs/local, /file/ls and /ls, but not /files/ls ?
    (the default files are readme, security-note, etc - I presume that they are also stored in the local mutable file system, no ?)

  • /filestore/ls
    which file store ?

many thanks !
canal.

mutable file system and linux file system
are they the same ?

MFS/“mutable filesystem” is our terminology for a copy-on-write mutable filesystem written on-top-of IPFS. It’s not a regular linux filesystem although we plan on adding the ability to mount it as a normal linux filesystem.

Basically, it’s a convenient way to add/remove/manage files in IPFS and may eventually replace the pinning system.

is it correct that the files I added to my local mutable file system is only uploaded to a remote machine if the file is accessed by the remote machine ?

Yes. Any file added to IPFS (using MFS or otherwise) is only added to your local node’s datastore. While your node will tell the network that you have the file, it won’t explicitly upload it anywhere. A peer has to request the file to replicate it.

if you want auto replication, take a look at the ipfs-cluster project.

in the network, is the file sharded ?

Yes.

if so, what’s the algorithm to determine how the file is sharded ?

By default, it’s sharded into 256KiB chunks. However, this is configurable. Take a look at the chunker section of the documentation for the ipfs add command (ipfs add --help).

/ls, /file/ls, and /files/ls commands

  • ls is the standard “list an IPFS directory” command.
  • file/ls is deprecated
  • files/ls is for listing files in MFS (all ipfs files * commands are MFS related).

/refs/local and the ls commands above

This command just lists the hashes of all the blocks (file chunks) currently stored on the node.

/filestore/ls

If you enable the filestore experimental feature, you can add files to ipfs with the --nocopy option and, instead of actually copying the data from these files to the local IPFS repo (database), it will simply record which files to get the data from. This means users can make files accessible from IPFS while still storing them outside of IPFS without the data twice.

Thank you very much for the information, stebalien !

for the sharding, just wanted to confirm that the 256KB chunks are distributed among several IPFS nodes, not just on one node right ?

No, I do not think IPFS distributes the chunks across nodes - it is not likely the way a P2P system does ?

IPFS is p2p in that peers can download files directly from your machine without having to go through an intermediate server. However, it won’t “upload” your files to other nodes. They’ll have to request them to get them.

if you want auto replication, take a look at the ipfs-cluster project
[/quote]

I’m a new to IPFS and installed IPFS in my machine. Can i auto replicate only to two other machines every time when i store a file.
Second questions is, can i only have limited participants in IPFS. I don’t want my content to be stored by other unknown participants.