GNU/Linux (fstab)

Arquivo fstab totalmente comentado.

Categoria: Init

Software: GNU/Linux

[ Hits: 22.309 ]

Por: José Lopes


Este é um meta-arquivo fstab, bem comentado e com descrições sobre o preenchimento de cada coluna. Este arquivo traz a configuração padrão de montagem do GNU/Linux (diretório raíz, proc e swap) e ainda exemplo com partição Windows, Disquetes, DVD-ROM, além da montagem de diversos diretórios da árvore de diretórios em partições separadas. Os comentários estão em inglês, mas para aqueles que não entenderem esta linguagem, sugiro acessar o endereço http://www.linuxbsd.com.br/portal/index.php?q=node/66 para esclarecimentos sobre o arquivo.


# FSTAB - File System TABle
# NAME .........: fstab
# AUTHOR .......: José Lopes de Oliveira Júnior
# DESCRIPTION ..: Saves static information about the filesystems.
# INSTRUCTIONS .: Copy this file to the /etc directory and give it 644
#    permission.
#===============================================================================

#===============================================================================
# FIELDS' EXPLANATION
#    Type "$ man 5 fstab" for more details about these fields.
#    Type "$ man 8 mount" for more details about mount options and supported
# filesystems.
#===============================================================================
# 1. The first field, (fs_spec), describes the block special device or remote
#    filesystem to be mounted.
#    Ex.: /dev/sda1
# 2. The second field, (fs_file), describes the mount point for the filesystem.
#    For swap partitions, this field should be specified as `none'. If the name
#    of the mount point contains spaces these can be escaped as `# FSTAB - File System TABle
# NAME .........: fstab
# AUTHOR .......: José Lopes de Oliveira Júnior
# DESCRIPTION ..: Saves static information about the filesystems.
# INSTRUCTIONS .: Copy this file to the /etc directory and give it 644
#    permission.
#===============================================================================

#===============================================================================
# FIELDS' EXPLANATION
#    Type "$ man 5 fstab" for more details about these fields.
#    Type "$ man 8 mount" for more details about mount options and supported
# filesystems.
#===============================================================================
# 1. The first field, (fs_spec), describes the block special device or remote
#    filesystem to be mounted.
#    Ex.: /dev/sda1
# 2. The second field, (fs_file), describes the mount point for the filesystem.
#    For swap partitions, this field should be specified as `none'. If the name
#    of the mount point contains spaces these can be escaped as `{CONTEUDO}40'.
#    Ex.: /mnt/cdrom
# 3. The third field, (fs_vfstype), describes the type of the filesystem. Linux
#    supports lots of filesystem types, such as adfs, affs, autofs, coda,
#    coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix,
#    msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs,
#    udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details,
#    see mount(8). For the filesystems currently supported by the running
#    kernel, see /proc/filesystems. An entry swap denotes a file or partition to
#    be used for swapping, cf. swapon(8). An entry ignore causes the line to be
#    ignored. This is useful to show disk partitions which are currently unused.
#    Ex.: auto
# 4. The fourth field, (fs_mntops), describes the mount options associated with
#    the filesystem.
#    Ex.: defaults
# 5. The fifth field, (fs_freq), is used for these filesystems by the dump(8)
#    command to determine which filesystems need to be dumped. If the fifth
#    field is not present, a value of zero is returned and dump will assume that
#    the filesystem does not need to be dumped.
#    Ex.: 0
# 6. The sixth field, (fs_passno), is used by the fsck(8) program to determine
#    the order in which filesystem checks are done at reboot time. The root
#    filesystem should be specified with a fs_passno of 1, and other filesystems
#    should have a fs_passno of 2. Filesystems within a drive will be checked
#    sequentially, but filesystems on different drives will be checked at the
#    same time to utilize parallelism available in the hardware. If the sixth
#    field is not present or zero, a value of zero is returned and fsck will
#    assume that the filesystem does not need to be checked.
#    Ex.: 2

#===============================================================================
# FILESYSTEMS' ENTRIES
#===============================================================================
# Swap Partition ---------------------------------------------------------------
/dev/hda5   none      swap   defaults         0 0

# Root Filesystem --------------------------------------------------------------
/dev/hda1   /      xfs   defaults         0 1

# Another System's Mounting Points ---------------------------------------------
/dev/hda6   /tmp      xfs   defaults         0 2
/dev/hda7   /var      xfs   defaults         0 2
/dev/hda8   /opt      xfs   defaults         0 2
/dev/hda9   /usr      xfs   defaults         0 2
/dev/hda2   /home      xfs   defaults         0 2
/dev/hda3   /boot      xfs   defaults         0 2

# Another Operational Systems --------------------------------------------------
/dev/hda10   /mnt/win   ntfs   noexec,gid=100,uid=100      0 0

# Removable Medias -------------------------------------------------------------
/dev/fd0   /mnt/floppy   vfat   noauto,owner,user      0 0
/dev/dvdrom   /mnt/dvdrom   auto   noauto,owner,ro,user      0 0

# Proc & TMPFS Filesystems -----------------------------------------------------
none      /proc      proc   defaults         0 0
none      /dev/shm   tmpfs   nodev,nosuid,noexec      0 0

# EOF40'. #    Ex.: /mnt/cdrom # 3. The third field, (fs_vfstype), describes the type of the filesystem. Linux #    supports lots of filesystem types, such as adfs, affs, autofs, coda, #    coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, #    msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, #    udf, ufs, umsdos, vfat, xenix, xfs, and possibly others. For more details, #    see mount(8). For the filesystems currently supported by the running #    kernel, see /proc/filesystems. An entry swap denotes a file or partition to #    be used for swapping, cf. swapon(8). An entry ignore causes the line to be #    ignored. This is useful to show disk partitions which are currently unused. #    Ex.: auto # 4. The fourth field, (fs_mntops), describes the mount options associated with #    the filesystem. #    Ex.: defaults # 5. The fifth field, (fs_freq), is used for these filesystems by the dump(8) #    command to determine which filesystems need to be dumped. If the fifth #    field is not present, a value of zero is returned and dump will assume that #    the filesystem does not need to be dumped. #    Ex.: 0 # 6. The sixth field, (fs_passno), is used by the fsck(8) program to determine #    the order in which filesystem checks are done at reboot time. The root #    filesystem should be specified with a fs_passno of 1, and other filesystems #    should have a fs_passno of 2. Filesystems within a drive will be checked #    sequentially, but filesystems on different drives will be checked at the #    same time to utilize parallelism available in the hardware. If the sixth #    field is not present or zero, a value of zero is returned and fsck will #    assume that the filesystem does not need to be checked. #    Ex.: 2 #=============================================================================== # FILESYSTEMS' ENTRIES #=============================================================================== # Swap Partition --------------------------------------------------------------- /dev/hda5   none      swap   defaults         0 0 # Root Filesystem -------------------------------------------------------------- /dev/hda1   /      xfs   defaults         0 1 # Another System's Mounting Points --------------------------------------------- /dev/hda6   /tmp      xfs   defaults         0 2 /dev/hda7   /var      xfs   defaults         0 2 /dev/hda8   /opt      xfs   defaults         0 2 /dev/hda9   /usr      xfs   defaults         0 2 /dev/hda2   /home      xfs   defaults         0 2 /dev/hda3   /boot      xfs   defaults         0 2 # Another Operational Systems -------------------------------------------------- /dev/hda10   /mnt/win   ntfs   noexec,gid=100,uid=100      0 0 # Removable Medias ------------------------------------------------------------- /dev/fd0   /mnt/floppy   vfat   noauto,owner,user      0 0 /dev/dvdrom   /mnt/dvdrom   auto   noauto,owner,ro,user      0 0 # Proc & TMPFS Filesystems ----------------------------------------------------- none      /proc      proc   defaults         0 0 none      /dev/shm   tmpfs   nodev,nosuid,noexec      0 0 # EOF
  


Comentários
[1] Comentário enviado por fabiobarby em 04/09/2006 - 23:54h

acho q faltou somente como montar um diretorio remoto no fstab...

192.168.0.1:/dir_compartilhado /mnt/dir_ompartilhado nfs rw 0 0

[2] Comentário enviado por forkd em 05/09/2006 - 13:55h

Bem lembrado Fabio!

A sintaxe pra montar um diretório remoto é:

IP_OU_NOME_REMOTO:DIR_COMPARTILHADO PONTO_MONTAGEM_LOCAL nfs OPCOES 0 0

Ex.:
machine.linux.org.br:/mnt/share /mnt/remoto nfs user,noauto,ro 0 0

;)

[3] Comentário enviado por kasa1982 em 26/10/2006 - 09:35h

Pessoal, não consegui localizar em nenhum lugar uma resposta pra minha dúvida cruel, estou tentando montar de forma automática no fstab partições compartilhadas com meu WinServer2003, tipo Server/Docs usando o sistema cifs, quando monto na linha de comando a sintaxe 'mount -t cifs -o username=USER,password=PASSWD //SERVER/DOCS /mnt/DOCS' funciona perfeitamente, consigo ver dentro do mnt as partições q foram montadas, mas como faço pra jogar isso pra dentro do fstab pra montar automaticamente quando o linux for iniciado?. OBS: utilizo CL10.

Obrigado

[4] Comentário enviado por BenyPereira em 10/03/2010 - 13:30h

Sei que o tópico é antigo mas a dúvida do post anterior não teve resposta. Provavelmente o usuário já aprendeu como se faz isso. Apenas para ajudar a algum outro que leia e tenha esta dúvida, coloco a resposta aproveitando o exemplo da configuração acima:

//192.168.0.1/teste /mnt/teste smb auto,user,username=nome,password=abcde 0 0

Onde: [itens separados por espaço]

//192.168.0.1/teste = IP da máquina remota e pasta que será compartilhada

/mnt/teste = ponto de montagem na máquina local

smb = sistema de arquivos utilizado - não configure este item como "auto"

- opções [os sub-itens separados por vírgula não tem espaço entre si - cuidado]
auto, = para fazer a montagem automática - para desabilitar substitua por "noauto"
user, = permitir acesso a usuários que não são root
username=nome, = nome do usuário a ser logado automaticamente
password=abcde = senha deste usuário para o acesso remoto

OBS.: Ao invés de utilizar as opções "username" e "password", seria mais seguro criar um arquivo com a lista de usuários autorizados e senhas. Este arquivo pode ser colocado no diretório do root com direitos de leitura e escrita reservados de arquivo reservados apenas ao root. Neste caso a opção utilizada seria "credentials=/home/root/.smbpasswd" Ex.:

//192.168.0.1/teste /mnt/teste smb auto,user,credentials=/home/root/.smbpasswd 0 0

Onde:
credentials = é a opção de chamar um arquivo reservado com login e senha
=/home/root/ = é o local onde o arquivo está alocado na máquina do usuário
.smbpasswd = é o nome do arquivo onde estão registrados os logins e senhas autorizados.

Nota:
1 - Para os casos em que a senha é fixada no "fstab" deve-se tomar o cuidado de bloquear o acesso de leitura e escrita para usuários que não sejam root. Esta medida de segurança é de suma importância. Rode o comando: "# chmod 600 /etc/fstab"
2 - idem para o arquivo listado na opção "credentials"

.


Contribuir com comentário

  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts