LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-12-2016, 02:29 PM   #1
William76
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Rep: Reputation: Disabled
Avoiding Partition Probes


Firstly, I'm feeling honored being here.


When a usb Hard Drive is attached I guess that (basically) kernel detects drive features (size, model, etc.), then it starts partitions table detection. After that udev creates correspondent block devices in /dev/ directory. Am I right?

How to prevent any kind of partition probes when a HDD is detected by a booted up system, in a way that it only detects basic drive features as model, sector size and capacity, consequently creating just one block device as /dev/sda?

It's about a data recovery experience with a damaged HDD that sectors corresponding to partition table should not being read.


Sorry about my poor english.


Thanks in advance.

William.
 
Old 10-13-2016, 11:51 AM   #2
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Rep: Reputation: 37
Depends on OS you're using, but most will NOT mount the drive automatically. When you attach the disk, it will create the /dev/sdX and nothing else.

If your OS does mount the drive automatically, you can always get into init 3 (no GUI) and work there. Typically all the auto-mount features are only present in init 5.
 
Old 10-13-2016, 02:38 PM   #3
William76
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by designator View Post
most will NOT mount the drive automatically
I'm not talking about auto-mount, it's already disabled. The sectors linked to partitions table shouldn't even be read. They're on a scratched area. When heads pass over there, drive crashes. I need to disable partitons detection. Look...

Dmesg Output

Oct 13 16:21:42 wks-01 kernel: [ 904.788084] ...ready
Oct 13 16:21:42 wks-01 kernel: [ 906.796660] sd 8:0:0:0: [sdb] 1953525167 512-byte logical blocks: (1.00 TB/931 GiB)
Oct 13 16:21:42 wks-01 kernel: [ 906.796670] sd 8:0:0:0: [sdb] 2048-byte physical blocks
Oct 13 16:21:42 wks-01 kernel: [ 906.862030] sd 8:0:0:0: [sdb] Write Protect is off
Oct 13 16:21:42 wks-01 kernel: [ 906.862036] sd 8:0:0:0: [sdb] Mode Sense: 4f 00 00 00
Oct 13 16:21:42 wks-01 kernel: [ 906.862752] sd 8:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Oct 13 16:21:42 wks-01 kernel: [ 906.915646] sdb: sdb1


Udev Output

KERNEL[906.915935] add /devices/pci0000:00/0000:00:1d.7/usb8/8-3/8-3:1.0/host8/target8:0:0/8:0:0:0/block/sdb (block)
KERNEL[906.915999] add /devices/pci0000:00/0000:00:1d.7/usb8/8-3/8-3:1.0/host8/target8:0:0/8:0:0:0/block/sdb/sdb1 (block)
UDEV [907.060915] add /devices/pci0000:00/0000:00:1d.7/usb8/8-3/8-3:1.0/host8/target8:0:0/8:0:0:0/block/sdb (block)
UDEV [907.392087] add /devices/pci0000:00/0000:00:1d.7/usb8/8-3/8-3:1.0/host8/target8:0:0/8:0:0:0/block/sdb/sdb1 (block)


Thanks for replying.
 
Old 10-13-2016, 05:24 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I think you are out of luck.
The driver for that device will be issuing the ioctls to create the base device nodes - including for partition(s). Without the driver you can't talk to the device at all. udev merely reacts to the kernel uevents.
 
1 members found this post helpful.
Old 10-13-2016, 05:43 PM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Then again, reading the partition table does not necessarily mean the rest of the disk is read. At least in case of MBR.
 
Old 10-13-2016, 05:57 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Emerson View Post
Then again, reading the partition table does not necessarily mean the rest of the disk is read. At least in case of MBR.
True, at least for primary partitions, but the nodes in /dev/disk/by-{id,label,uuid} require probing the content of the partition to get the needed parameters. I can see where udev rules use the parameters, but I don't see what establishes the values.
 
1 members found this post helpful.
Old 10-13-2016, 06:10 PM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Trashing udev and switching to static /dev would help. There is even a tutorial how to do it in Gentoo.
 
1 members found this post helpful.
Old 10-27-2016, 09:07 AM   #8
William76
LQ Newbie
 
Registered: Oct 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
Trashing udev and switching to static /dev would help. There is even a tutorial how to do it in Gentoo.
I guess kernel recognizes partitions as soon as a drive is plugged in, so after that udev creates /dev/* files... I mean partition table is read by kernel and HDD heads runs over the damaged area. I don't think udev can stop that kernel routine.

What do you think?

Thanks.
 
Old 10-27-2016, 09:15 AM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You can build partition table support as module, then kernel can't load it at boot time and won't scan the drives. You have to figure out from what media to boot it that does not require MBR/GPT support in kernel. CD/DVD would work, I guess. My 2¢.
 
Old 10-27-2016, 09:50 AM   #10
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
nfsroot could also work. Even if you don't go with a full PXE diskless boot setup, you can set up a custom grub2 entry to boot up to an nfs root.

http://www.linuxquestions.org/questi...-jessie-37127/

While grub2 will load up with sufficient support to detect and load the initrd etc from a local hard drive partition, it's not necessary for the loaded kernel to have any support for partitions at all. It only needs the nfs client.

Note that you don't need to mess around with your DHCP server or settings to do this. You just need to set up any computer on the same LAN with an nfs share.
 
1 members found this post helpful.
Old 10-27-2016, 10:13 AM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Or you could even leave out the support for HDD controller(s) and boot the kernel from USB. Just thinking, I haven't tested such a setup. You still need SCSI layer enabled, even USB block device access goes thru it nowadays.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Network probes JJJCR Linux - Security 10 05-04-2016 02:03 AM
Possible successful probes detected newbie14 Linux - Security 25 04-26-2013 09:51 AM
Kubuntu - which version and how to get it - avoiding no such partition error hrossm Linux - Laptop and Netbook 4 06-18-2012 05:28 AM
temperature probes for smoker Eppo Linux - Hardware 10 01-21-2012 06:50 PM
Perl Probes rootyard Programming 0 03-17-2004 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration