renato_pacheco
(usa Debian)
Enviado em 13/08/2014 - 16:11h
Cara, o método q t passei é bem mais fácil, MAS... se vc quer por dificuldade na sua vida, vc pode fixar os /dev através do udev. Vc executa o comando abaixo quando vc plugar o seu HD (supondo q ele pegou sdb1):
udevadm info --query all --path /sys/block/sdb/sdb1 --attribute-walk
A saída vai sair bem parecida com essa (os próximos comandos vão se basear no exemplo abaixo):
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/block/sdb/sdb1':
KERNEL=="sdb1"
SUBSYSTEM=="block"
DRIVER==""
ATTR{partition}=="1"
ATTR{start}=="2048"
ATTR{size}=="1250260992"
ATTR{alignment_offset}=="0"
ATTR{stat}==" 73 30 818 380 1 0 8 0 0 376 380"
ATTR{inflight}==" 0 0"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5:1.0/host6/target6:0:0/6:0:0:0/block/sdb':
KERNELS=="sdb"
SUBSYSTEMS=="block"
DRIVERS==""
ATTRS{range}=="16"
ATTRS{ext_range}=="256"
ATTRS{removable}=="0"
ATTRS{ro}=="0"
ATTRS{size}=="1250263728"
ATTRS{alignment_offset}=="0"
ATTRS{capability}=="52"
ATTRS{stat}==" 100 33 1058 756 1 0 8 0 0 752 756"
ATTRS{inflight}==" 0 0"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5:1.0/host6/target6:0:0/6:0:0:0':
KERNELS=="6:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{device_blocked}=="0"
ATTRS{type}=="0"
ATTRS{scsi_level}=="3"
ATTRS{vendor}=="SAMSUNG "
ATTRS{model}=="HM641JI "
ATTRS{rev}==" "
ATTRS{state}=="running"
ATTRS{timeout}=="30"
ATTRS{iocounterbits}=="32"
ATTRS{iorequest_cnt}=="0x76"
ATTRS{iodone_cnt}=="0x76"
ATTRS{ioerr_cnt}=="0x0"
ATTRS{modalias}=="scsi:t-0x00"
ATTRS{evt_media_change}=="0"
ATTRS{queue_depth}=="1"
ATTRS{queue_type}=="none"
ATTRS{max_sectors}=="240"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5:1.0/host6/target6:0:0':
KERNELS=="target6:0:0"
SUBSYSTEMS=="scsi"
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5:1.0/host6':
KERNELS=="host6"
SUBSYSTEMS=="scsi"
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5:1.0':
KERNELS=="1-5:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usb-storage"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bNumEndpoints}=="02"
ATTRS{bInterfaceClass}=="08"
ATTRS{bInterfaceSubClass}=="06"
ATTRS{bInterfaceProtocol}=="50"
ATTRS{modalias}=="usb:v152Dp2329d0100dc00dsc00dp00ic08isc06ip50"
ATTRS{supports_autosuspend}=="0"
ATTRS{interface}=="MSC Bulk-Only Transfer"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1/1-5':
KERNELS=="1-5"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}=="USB Mass Storage"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="c0"
ATTRS{bMaxPower}==" 2mA"
ATTRS{urbnum}=="374"
ATTRS{idVendor}=="152d"
ATTRS{idProduct}=="2329"
ATTRS{bcdDevice}=="0100"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="480"
ATTRS{busnum}=="1"
ATTRS{devnum}=="4"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="JMicron"
ATTRS{product}=="USB to ATA/ATAPI Bridge"
ATTRS{serial}=="2390A02056FF"
looking at parent device '/devices/pci0000:00/0000:00:1a.7/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 1"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="e0"
ATTRS{bMaxPower}==" 0mA"
ATTRS{urbnum}=="49"
ATTRS{idVendor}=="1d6b"
ATTRS{idProduct}=="0002"
ATTRS{bcdDevice}=="0206"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{speed}=="480"
ATTRS{busnum}=="1"
ATTRS{devnum}=="1"
ATTRS{version}==" 2.00"
ATTRS{maxchild}=="6"
ATTRS{quirks}=="0x0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="Linux 2.6.32-5-686 ehci_hcd"
ATTRS{product}=="EHCI Host Controller"
ATTRS{serial}=="0000:00:1a.7"
ATTRS{authorized_default}=="1"
looking at parent device '/devices/pci0000:00/0000:00:1a.7':
KERNELS=="0000:00:1a.7"
SUBSYSTEMS=="pci"
DRIVERS=="ehci_hcd"
ATTRS{vendor}=="0x8086"
ATTRS{device}=="0x3b3c"
ATTRS{subsystem_vendor}=="0x1458"
ATTRS{subsystem_device}=="0x5006"
ATTRS{class}=="0x0c0320"
ATTRS{irq}=="18"
ATTRS{local_cpus}=="ffffffff"
ATTRS{local_cpulist}=="0-31"
ATTRS{modalias}=="pci:v00008086d00003B3Csv00001458sd00005006bc0Csc03i20"
ATTRS{enable}=="1"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""
ATTRS{companion}==""
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Ae vc cria um arquivo novo neste caminho /etc/udev/rules.d/90-backup.rules e insere os dados lá assim:
ATTRS{vendor}=="SAMSUNG ", ATTRS{model}=="HM641JI ", SYMLINK+="sdb1"
Ae, basta reiniciar o udev (se for Debian ou Debian-like):
invoke-rc.d udev restart
Ae vc desplugue e plugue novamente e veja se o seu HD foi listado como /dev/sdb1, com o comando
fdisk -l .
Fonte:
http://www.zeitoun.net/articles/udev-rules-presistent-external-disk/start