PDA

View Full Version : Stop HDD changing it's name.


tizwoz
2006-09-06, 10:27 AM CDT
I've got an 80gb external harddrive which I have now set up with Cryptoloop. The problem is, Cryptoloop won't work properly because the hdd keeps changing it's name (sde2/sdb2/sba2 etc etc) so everytime I boot up, I have to go through the whole setup process with Cryptoloop (which takes a long time to do)

Is there a way to stop this happening? Perhaps I have formatted it the wrong way?

I have used partition magic 7.0 (on another windows laptop) and I formatted it into fat32. I made two 39gb (ish, or there abouts) partitions one of them which I'm using for Cryptoloop.

I might add that (at the time of creating the paritions) the software wouldn't allow me to create partitions bigger than 4 gb unless I said it was a primary drive for an operating system.

Any idea's how I can stop it changing it's name? Maybe I need to re-format it with other software? Any suggestions? :confused:

daneel971
2006-09-06, 10:43 AM CDT
write a udev rule, so that whenever you mount your external hd the same symlink will be created in /dev: do your cryptoloop setup pointing to that symlink.

tizwoz
2006-09-06, 11:15 AM CDT
Ok, i've done a search for udev and I'm a bit confused what I need to edit :confused:

Is it a line like /etc/grub.conf or something but with udev init? Also, what sort of entries do I need init? :confused:

daneel971
2006-09-06, 12:19 PM CDT
Do a google search for "writing udev rules" - you will find a little outdated but still very useful guide. The syntax of the *.rules file s is changed, so take a look at the existing ones in /etc/udev/rules.d

When you plug the drive in, a new device is created under the directory /dev;
It should be called something like sdX1 (being X a letter starting from "a", depending on how many usb/sata etc. devices you have; I assume you have only one partition on the device).
Open a terminal and (assuming this is the only usb/sata etc. device connected at the moment to the pc) type
udevinfo -a -p /block/sda/sda1
In the output search for the lines with these data and note them down (it's possible that you don't have all of them - it's ok)

SYSFS{serial}=="1212121212"
SYSFS{product}=="MYDRIVE"
SYSFS{manufacturer}=="MAXTOR "
SYSFS{model}=="123456"
SYSFS{vendor}=="MAXTOR"

The data above are obviously only an example.
Open a text editor and create a file called 20-custom.rules
Put in it these line (one line)
SYSFS{serial}=="1212121212",SYSFS{product}=="MYDRIVE",SYSFS{manufacturer}=="PLEXTOR","KERNEL=="sd?1",SYMLINK=="cryptedHD"
Save the file and copy it in the dir /etc/udev/rules.d (you have to be root for this).
Then open (as root) /etc/fstab and add this line:
/dev/cryptedHD /mnt/cryptedHD ext3 noauto,user,owner,rw 0 0
Save the file.
Under /mnt create (as root) a directory "cryptoHD"
Unplug the drive - wait for a few secs; replug it in.
mount /mnt/cryptoHD
The drive is now mounted. Go configure your cryptolook, now :)

tizwoz
2006-09-06, 01:16 PM CDT
Thank you, thank you for your full reply, most appreciated :) :)

All seems to be working except I think i'm going wrong on my udev rule. (When I go to mount it doesn't really open it up, I'm guessing that I've got the wrong codes and the wrong device). I can't work out which hdd it is. Also, this is on a laptop, this is the only connected hdd but I'm still really confused! :S

This is the output of udevinfo -a -p /block/sda/sda1

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

looking at device '/block/sda/sda1':
KERNEL=="sda1"
SUBSYSTEM=="block"
SYSFS{stat}==" 381 381 0 0"
SYSFS{size}=="160071597"
SYSFS{start}=="63"
SYSFS{dev}=="8:1"

looking at device '/block/sda':
ID=="sda"
BUS=="block"
DRIVER==""
SYSFS{stat}==" 44 384 757 680 0 0 0 0 0 580 680"
SYSFS{size}=="160086528"
SYSFS{removable}=="0"
SYSFS{range}=="16"
SYSFS{dev}=="8:0"

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3/3-2/3-2:1.0/host7/target7:0:0/7:0:0:0':
ID=="7:0:0:0"
BUS=="scsi"
DRIVER=="sd"
SYSFS{ioerr_cnt}=="0x0"
SYSFS{iodone_cnt}=="0x33"
SYSFS{iorequest_cnt}=="0x33"
SYSFS{iocounterbits}=="32"
SYSFS{timeout}=="60"
SYSFS{state}=="running"
SYSFS{rev}=="BACE"
SYSFS{model}=="L080M0 "
SYSFS{vendor}=="Maxtor 6"
SYSFS{scsi_level}=="3"
SYSFS{type}=="0"
SYSFS{queue_type}=="none"
SYSFS{queue_depth}=="1"
SYSFS{device_blocked}=="0"
SYSFS{max_sectors}=="240"

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3/3-2/3-2:1.0/host7/target7:0:0':
ID=="target7:0:0"
BUS==""
DRIVER==""

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3/3-2/3-2:1.0/host7':
ID=="host7"
BUS==""
DRIVER==""

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3/3-2/3-2:1.0':
ID=="3-2:1.0"
BUS=="usb"
DRIVER=="usb-storage"
SYSFS{modalias}=="usb:v067Bp2507d0100dc00dsc00dp00ic08isc06ip50"
SYSFS{bInterfaceProtocol}=="50"
SYSFS{bInterfaceSubClass}=="06"
SYSFS{bInterfaceClass}=="08"
SYSFS{bNumEndpoints}=="02"
SYSFS{bAlternateSetting}==" 0"
SYSFS{bInterfaceNumber}=="00"

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3/3-2':
ID=="3-2"
BUS=="usb"
DRIVER=="usb"
SYSFS{configuration}==""
SYSFS{product}=="Mass Storage Device"
SYSFS{manufacturer}=="Prolific Technology Inc."
SYSFS{maxchild}=="0"
SYSFS{version}==" 2.00"
SYSFS{devnum}=="8"
SYSFS{speed}=="12"
SYSFS{bMaxPacketSize0}=="64"
SYSFS{bNumConfigurations}=="1"
SYSFS{bDeviceProtocol}=="00"
SYSFS{bDeviceSubClass}=="00"
SYSFS{bDeviceClass}=="00"
SYSFS{bcdDevice}=="0100"
SYSFS{idProduct}=="2507"
SYSFS{idVendor}=="067b"
SYSFS{bMaxPower}=="100mA"
SYSFS{bmAttributes}=="c0"
SYSFS{bConfigurationValue}=="1"
SYSFS{bNumInterfaces}==" 1"

looking at device '/devices/pci0000:00/0000:00:1d.2/usb3':
ID=="usb3"
BUS=="usb"
DRIVER=="usb"
SYSFS{configuration}==""
SYSFS{serial}=="0000:00:1d.2"
SYSFS{product}=="UHCI Host Controller"
SYSFS{manufacturer}=="Linux 2.6.17-1.2174_FC5 uhci_hcd"
SYSFS{maxchild}=="2"
SYSFS{version}==" 1.10"
SYSFS{devnum}=="1"
SYSFS{speed}=="12"
SYSFS{bMaxPacketSize0}=="64"
SYSFS{bNumConfigurations}=="1"
SYSFS{bDeviceProtocol}=="00"
SYSFS{bDeviceSubClass}=="00"
SYSFS{bDeviceClass}=="09"
SYSFS{bcdDevice}=="0206"
SYSFS{idProduct}=="0000"
SYSFS{idVendor}=="0000"
SYSFS{bMaxPower}==" 0mA"
SYSFS{bmAttributes}=="e0"
SYSFS{bConfigurationValue}=="1"
SYSFS{bNumInterfaces}==" 1"

looking at device '/devices/pci0000:00/0000:00:1d.2':
ID=="0000:00:1d.2"
BUS=="pci"
DRIVER=="uhci_hcd"
SYSFS{modalias}=="pci:v00008086d00002487sv00008086sd00004541bc0Csc03 i00"
SYSFS{local_cpus}=="1"
SYSFS{irq}=="11"
SYSFS{class}=="0x0c0300"
SYSFS{subsystem_device}=="0x4541"
SYSFS{subsystem_vendor}=="0x8086"
SYSFS{device}=="0x2487"
SYSFS{vendor}=="0x8086"

looking at device '/devices/pci0000:00':
ID=="pci0000:00"
BUS==""
DRIVER==""



Which looks most likely? :confused: It's not partitioned off and it is in FAT32. Sorry to bug

daneel971
2006-09-06, 01:27 PM CDT
On a single line, the rule should be.
SYSFS{model}=="L080M0 ",SYSFS{vendor}=="Maxtor 6",KERNEL=="sd?1",SYMLINK=="cryptoHD"

Put in a file called 20-custom.rules under /etc/udev/rules.d and retry. If after unplugging and replugging the disk the symlink criptoHD doesn't appear in /dev, try running as root "udevstart".
Note that the spaces in the SYSFS{model} field - you'd better copy and paste the results of udevinfo into a text file.

EDIT
It's not partitioned off and it is in FAT32.
Use vfat instead of ext3 in the fstab line you create for this device.
BTW: if it's fat32, it is partitioned... otherwise, you couldn't use it :)

tizwoz
2006-09-06, 02:04 PM CDT
EDIT

Use vfat instead of ext3 in the fstab line you create for this device.
BTW: if it's fat32, it is partitioned... otherwise, you couldn't use it :)

That's the bit I needed! I must've tried it 20 times before I refreshed the page and noticed the edit :D

Working brill! Thank you ever, ever, ever, ever so much!! I did google for it and found a udev rule thing, but it was all double dutch to me, I couldn't really make head nor tail of it - I am a female after all, shhhhhh :D :D :D

Thank you again!!!! :) :) :) :) :)

tizwoz
2006-09-06, 02:04 PM CDT
BTW: if it's fat32, it is partitioned... otherwise, you couldn't use it :)

Oh ye, doh! lol :D