Difference between revisions of "NFS"

From Alessandro's Wiki
 
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
E`molto potente ma ha degli svantaggi, pochi in realtà.
E`molto potente ma ha degli svantaggi, pochi in realtà.


== Export ==
* Nel mio caso ho bisogno di accedere a risorse del computer della camera da quello della cucina:
* Nel mio caso ho bisogno di accedere a risorse del computer della camera da quello della cucina:
* Esporterò le seguenti directory:
* Esporterò le seguenti directory:
# /mnt/repositorio
# /export
# /export
# /mnt/mirror160
# /mnt/musica300
# /mnt/lacie250/


* Modifico il file /etc/exports per dire a NFS di espoortare queste directory a chi e come:
* Modifico il file /etc/exports per dire a NFS di espoortare queste directory a chi e come:
Line 14: Line 11:
* Aggiungo le seguenti linee:
* Aggiungo le seguenti linee:
  /export/                192.168.1.251(rw,async,no_root_squash)
  /export/                192.168.1.251(rw,async,no_root_squash)
/mnt/musica300/        192.168.1.251(rw,async)
/mnt/mirror160/        192.168.1.251(rw,sync)
/mnt/lacie250/          192.168.1.251(rw,no_root_squash,sync)
/mnt/repositorio/      192.168.1.251(rw,sync)
* la formattazione è '''''Directory | ip/domain/hostname(opzione,opzione,...)'''''
* la formattazione è '''''Directory | ip/domain/hostname(opzione,opzione,...)'''''
* '''rw'''  dal client sarà possibile scrivere nella directory
* '''rw'''  dal client sarà possibile scrivere nella directory
* '''sync''' tutte le operazioni di scrittura vengono eseguite in modo sincrono
* '''sync''' tutte le operazioni di scrittura vengono eseguite in modo sincrono
* '''no_root_squash''' vuoldire che se dal client monto la partizione e cerco di modificare qualche file come root, il root del server viene mappato con il root del client
* '''no_root_squash''' vuoldire che se dal client monto la partizione e cerco di modificare qualche file come root, il root del server viene mappato con il root del client
* Avvio/riavvio il demone nfsd:
* Ricarico file di configurazione:
  /etc/init.d/nfs start
  /etc/init.d/nfs reload
* Oppure
* reload the exports table
  /etc/init.d/nfs restart
  exportfs -ra
* Ora dal client sarà possibile montare la partizione in questo modo:
* Ora dal client sarà possibile montare la partizione in questo modo:
  mkdir /mnt/remote_export
  mkdir /mnt/remote_export
Line 31: Line 24:
* ls -la /mnt/remote_export
* ls -la /mnt/remote_export


==== Server nfsd ====
* check open ports:
  rpcinfo -p | awk -F " " '{print $3 ", " $4 ", " $5}' | sort | uniq


===== Configurazione =====
=== Configuration ===


* In [[Gentoo]]
* In [[Gentoo]]
** File di configurazione generale
** File di configurazione generale
  /etc/conf.d/nfs
  /etc/conf.d/nfs
* In [[Fedora]]
** File di configurazione generale (Fedora se lo fa + a modo suo, in realtà questo file è di avvio del demonio)
/etc/init.d/nfs


* Directory attualmente esportate:
* Directory attualmente esportate:


  elwood ~ # exportfs
  elwood ~ # exportfs
/mnt/repositorio/video zombie
/mnt/repositorio      zombie
/mnt/musica300  zombie
/mnt/mirror160  zombie
/mnt/musica80  zombie
/mnt/lacie250  zombie
  /export        zombie
  /export        zombie
  /export        192.168.1.123
 
  /root          zombie
== From the Client ==
 
*show remote mounts
showmount -e <hostname>
 
=== ubuntu ===
* to allow the system to mount a NFS share, you need to install:
apt-get install nfs-common
 
= Benchmarks =
 
== NFSometer ==
* deps
apt-get install python-numpy python-setuptools python-matplotlib python-mako
  yum  install numpy python-setuptools python-matplotlib python-mako -y     
 
<source lang=bash>
# ./nfsometer.py workloads
> Using results directory: /root/nfsometer_results
Available workloads:
  cthon
  dd_100m_100k
  dd_100m_1k
  gitclone
  kernel
  python
Unavailable workloads:
  bonnie++            - binary 'bonnie++' not found,
  custom              - env variable 'NFSOMETER_CMD' not defined,
  filebench_fileserver - binary 'filebench' not found, file '/usr/share/filebench/workloads/fileserver.f' not found,
  filebench_networkfs  - binary 'filebench' not found, file '/usr/share/filebench/workloads/networkfs.f' not found,
  filebench_varmail    - binary 'filebench' not found, file '/usr/share/filebench/workloads/varmail.f' not found,
  filebench_webserver - binary 'filebench' not found, file '/usr/share/filebench/workloads/webserver.f' not found,
  iozone              - binary 'iozone' not found,
  iozone_direct        - binary 'iozone' not found,
</source>

Latest revision as of 22:09, 10 September 2015

Nfs, Network File System serve per condividere dati tra due o + computer in rete, con linux naturalmente. E`molto potente ma ha degli svantaggi, pochi in realtà.

Export

  • Nel mio caso ho bisogno di accedere a risorse del computer della camera da quello della cucina:
  • Esporterò le seguenti directory:
  1. /export
  • Modifico il file /etc/exports per dire a NFS di espoortare queste directory a chi e come:
vi /etc/exports
  • Aggiungo le seguenti linee:
/export/                192.168.1.251(rw,async,no_root_squash)
  • la formattazione è Directory | ip/domain/hostname(opzione,opzione,...)
  • rw dal client sarà possibile scrivere nella directory
  • sync tutte le operazioni di scrittura vengono eseguite in modo sincrono
  • no_root_squash vuoldire che se dal client monto la partizione e cerco di modificare qualche file come root, il root del server viene mappato con il root del client
  • Ricarico file di configurazione:
/etc/init.d/nfs reload
  • reload the exports table
exportfs -ra
  • Ora dal client sarà possibile montare la partizione in questo modo:
mkdir /mnt/remote_export
mount -t nfs -o rw,users elwood:/export /mnt/remote_export
  • ls -la /mnt/remote_export
  • check open ports:
 rpcinfo -p | awk -F " " '{print $3 ", " $4 ", " $5}' | sort | uniq

Configuration

  • In Gentoo
    • File di configurazione generale
/etc/conf.d/nfs
  • Directory attualmente esportate:
elwood ~ # exportfs
/export         zombie

From the Client

  • show remote mounts
showmount -e <hostname>

ubuntu

  • to allow the system to mount a NFS share, you need to install:
apt-get install nfs-common

Benchmarks

NFSometer

  • deps
apt-get install python-numpy python-setuptools python-matplotlib python-mako
yum  install numpy python-setuptools python-matplotlib python-mako -y       
# ./nfsometer.py workloads
> Using results directory: /root/nfsometer_results
Available workloads:
  cthon
  dd_100m_100k
  dd_100m_1k
  gitclone
  kernel
  python
Unavailable workloads:
  bonnie++             - binary 'bonnie++' not found,
  custom               - env variable 'NFSOMETER_CMD' not defined,
  filebench_fileserver - binary 'filebench' not found, file '/usr/share/filebench/workloads/fileserver.f' not found,
  filebench_networkfs  - binary 'filebench' not found, file '/usr/share/filebench/workloads/networkfs.f' not found,
  filebench_varmail    - binary 'filebench' not found, file '/usr/share/filebench/workloads/varmail.f' not found,
  filebench_webserver  - binary 'filebench' not found, file '/usr/share/filebench/workloads/webserver.f' not found,
  iozone               - binary 'iozone' not found,
  iozone_direct        - binary 'iozone' not found,