Introduccion:
Montar memorias USB en FreeBSD
El usuario root no tiene problemas para montar un dispositivo USB mediante el comando
Ver el dispositivo detectado por el sistema
   # dmesg
   # camcontrol devlist
Montar el dispositivo detectado
   # mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt
Este tutorial explica como permitir que los usuarios no-root puedan montar dispositivos USB.
Requerimientos:
* Acceso a root
* Leer este tutorial
Tutoriales:
https://www.freebsd.org/doc/handbook/usb-disks.html
http://www.codebuddies.de/2014/03/28/0x0b-howto-mount-a-extfat-filesystem-on-freebsd
https://forums.freebsd.org/threads/mount-exfat-fuse-as-regular-user.46985
http://olivier.cochard.me/bidouillage/installation-et-configuration-de-freebsd-comme-poste-de-travail
http://blog.desdelinux.net/freebsd-que-hacer-despues-instalar
https://forums.freebsd.org/threads/formatting-a-usb-stick.10986
http://www.freebsdonline.com/content/view/890/524
http://bsdgurl.net/text/formatting-external-disk-to-fat32.txt
El proceso:
Agregamos nuestro usuario john al grupo operator
# pw groupmod operator -m john
# edit /etc/devfs.rules
# USB Storage Devices
[localrules=5]
add path 'da*' mode 0660 group operator
# edit /etc/rc.conf
# USB Storage Devices           
devfs_system_ruleset="localrules"
# edit /etc/sysctl.conf
# USB Storage Devices
vfs.usermount=1
# sysctl vfs.usermount=1
# service devfs restart
# mkdir /mnt/usb
# chown john:john /mnt/usb
# camcontrol devlist
<Generic Flash Disk 5.00>          at scbus10 target 0 lun 0 (da0,pass7)
% ls /dev/da0*
/dev/da0s1
% mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt/usb
% umount /mnt/usb
Para facilitar el montar y desmontar la memoria, se puede usar el siguiente scirpt:
$ edit ~/Desktop/USB-Key.sh
#!/bin/sh
if [ "$(df -h | grep '/mnt/usb' | cut -d ' ' -f1)"  != '/dev/da0s1' ]; then
  echo 'Montando memoria'
  mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt/usb
  dolphin /mnt/usb > /dev/null 2>&1
else
  echo 'Desmontando memoria'
  killall dolphin 
  umount /mnt/usb
fi
Si necesitamos formatear el dispositivo USB (no debe estar montado)
Then we clean the drive (remove previous partition):
  # dd if=/dev/zero of=/dev/da0 bs=1m
Then we will create the slice:
  # fdisk -i da0
  
    Do you want to change our idea of what BIOS thinks ? [n]  Press Enter
    Do you want to change it?[n] Press Enter
    Do you want to change it?[n] Press Enter
    Do you want to change it?[n] Press Enter
    Do you want to change it?[n] Press Enter
    Do you want to change the active partition? [n] Press Enter
  
    Should we write new partition table? [n] Press y
Then we will create the FAT32 file system:
  # newfs_msdos -F32 /dev/da0s1
No comments:
Post a Comment