[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: Read-only USB scan

Ron Johnson wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">(Please don't top-post.)

On 12/20/08 18:18, Bhasker C V wrote:

 hdparm -r1 /dev/sda
works and I get this output when I read back the information with plain '-r'

  $ sudo hdparm -r /dev/sda

 readonly     =  1 (on)

Does this make it really read-only ?

That's what happens on my Firewire/SATA hard drive.

# hdparm -r1 /dev/sdc1

 setting readonly to 1 (on)
 readonly      =  1 (on)

# mount -v /data/02
mount: block device /dev/sdc1 is write-protected, mounting read-only
/dev/sdc1 on /data/02 type ext3 (ro)

# dd count=10 if=/dev/hda1 of=/data/02/foo.bar
dd: opening `/data/02/foo.bar': Read-only file system

My harddisk is having a PV and then a VG ... LV which if i mount, still is able to write to it ? [ VG activation is successful ]

(dont know if 'write' means really write a large file but I checked using touch command and I am still able to create the file)

My kernel is

Is there anything I am missing here ?

Since you've got so many layers logicalness between the app and the spindles, maybe you aren't really writing to the spindle you think you are writing to? Or LVM is setting the read flag?

I tried this too ... But i am sure that the data is getting written to be spindle. I deactivated the usb drive and then re-activated the VG and LVs in it and could see the data writeen intact !

So, my guess is that hdparm -r1 does not work on USB scanned devices and there is no method to make the device read-only [unless we try to stick out head into the physical hardware ] ? Is that what we are concluding ?

Ron Johnson wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">On 12/20/08 12:32, Bhasker C V wrote:
Hi all,

I have a server where there is a USB SCSI disk with lots of important data. The only problem is accidentally people try to understand some other similar ide-scsi disk (sdb may be) as the
 first one (sda) and delete data.

I was going to find out if there is any method so that I can make a disk (a particular device) read-only. i.e in case I insert this disk with very important data, I must be able to make this disk (may be scanned as sdX) as readonly so that people are only able to see the partition, mount it and use it ratherthan try to accidentally delete data which
will result in disk reporting it as read-only

[ PS: I am not referring a workaround of mouting a partition read-only which can still help, but i want the whole disk
  to be made read-only ]

# hdparm -r

You might have to crack open the USB enclosure and physically install the drive in a PC in order for this to work.

Bhasker C V
Registered Linux user: #306349 (counter.li.org)
The box said "Requires Windows 95, NT, or better", so I installed Linux.

Reply to: