Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is it possible to disable partition mapping on specific SATA disk?

I'm using ,say "sdb", disk for DRBD replication where KVM VM is installed directly. Because of that, /dev/sdb got partitions and host recognized it after reboot.

I'd like to compose a rule to completely ignore disk (partitions) on KVM host by connection path if possible.

I've already tried with these rules (and combinations of it) in 10-ignore-disk.rules, but none of them worked out of the box KERNEL=="sdb", GROUP="disk", OPTIONS:="last_rule" KERNEL=="sdb1",ENV{UDISKS_PRESENTATION_HIDE}="1" KERNEL=="sdb", OPTIONS:="ignore_device" KERNEL=="1:0:0:0", SUBSYSTEMS=="scsi", DRIVERS=="sd",OPTIONS:="last_rule"

share|improve this question
Not sure what you're trying to accomplish here. If you partition a disk, it's partitioned. If you don't partition a disk, it isn't partitioned. You can, for example, sudo mkfs.ext4 /dev/sdb and have that work swimmingly. Can you be more specific about what your end goal here is? – Jim Salter Nov 26 '12 at 3:17
Sorry for late response.To clarify, my VM has whole disk for it self "sdb" on host and during VM install I have partitioned disk inside VM (as "vda"). The problem is, after host reboot, it recognizes partition layout of VM and not just raw block device just it was before the VM got installed. I want to achieve similar behavior like if you have LV on host with kpartx -a /dev/VG0/LV0 and you get partition mapping in /dev/mapper/LV0p1, LV0p2 etc and remove partition mapping with kpartx -d /dev/VG0/LV0 – AlexT Dec 9 '12 at 22:47

OK, the problem is that since you gave the guest the whole disk, it's creating "real" partitions so of course the host can see them.

In the future if you want to avoid this happening, on the host, partition /dev/sdb with a single partition /dev/sdb1 that fills the whole disk; then give the guest /dev/sdb1 as a block device. The guest will then create its own partitions within /dev/sdb1 as its own native /dev/vda1, /dev/vda2, etc, and the host will only be able to see them via kpartx in the way you want it to.

You could also set up /dev/sdb1 as a block device for LVM on the host, create an LV within it, and give that to the guest as /dev/vda and partition from there. Whatever makes you happy (I generally give my guests LVs as raw devices, personally). Just avoid handing the guest the actual raw disk if you don't want it to create real partitions that the host sees and manipulates.

share|improve this answer
Hi again! Thank you for the potential answer, I appreciate it a lot for helping me! I'm very aware of these "workarounds" but I gave up. I let the host see partition layout of VM and hope it won't touch it. This way if anything happens I can just unplug disk containing VM and plug it in to real hardware or let it recognize to KVM host bootloader and have it on the list. – AlexT Mar 5 '13 at 22:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.