Bugzilla – Attachment 227827 Details for
Bug 397816
kpartx -a /dev/sda creates nothing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
activate_dm_linear
activate_dm_linear (text/plain), 1.71 KB, created by
Hannes Reinecke
on 2008-07-15 11:20:36 UTC
(
hide
)
Description:
activate_dm_linear
Filename:
MIME Type:
Creator:
Hannes Reinecke
Created:
2008-07-15 11:20:36 UTC
Size:
1.71 KB
patch
obsolete
>#!/bin/sh ># ># activate_dm_linear ># ># Activate a linear mapping on top of an existing block device. ># This allows for partitions to be mapped via kpartx, so all ># partitions on a device can be accessed. ># > >RULE=/etc/udev/rules.d/62-dm_linear.rules > >if [ -z "$1" ] ; then > echo "Usage: $0 [-d] devname" > exit 1 >fi > >if [ "$1" == "-d" ] ; then > remove_only=1 > shift >fi > >if [ ! -b "$1" ] ; then > echo "$1 is not a block device" > exit 1 >fi > >dev=${1#/dev/} > >if [ ! -d /sys/block/$dev ] ; then > echo "$1 is not a disk device" > exit 1 >fi > >blksize=$(/sbin/blockdev --getsize $1) >if [ $? -ne 0 ] ; then > echo "blockdev --getsize $1 failed: $?" > exit 1 >fi > >for link in $(udevinfo -q symlink -p /block/$dev) ; do > case "$link" in > */by-id/ata*) > atalink=${link#*/by-id/ata-} > ;; > */by-id/scsi*) > scsilink=${link#*/by-id/scsi-} > ;; > esac >done >if [ "$atalink" ] ; then > # Remove existing rules > echo "/$atalink/d >w >q >" | ed $RULE > /dev/null 2>&1 > [ "$remove_only" = 1 ] && exit 0 > cat >> $RULE <<EOF >ACTION=="add", KERNEL=="sd*[!0-9]", ENV{ID_VENDOR}=="ATA", ENV{ID_ATA_COMPAT}=="$atalink", RUN+="/bin/bash -c 'echo 0 $blksize linear \$major:\$minor 0 | /sbin/dmsetup create ata-\$env{ID_ATA_COMPAT} -u linear-ata-\$env{ID_ATA_COMPAT}'" >EOF >fi >if [ "$scsilink" ] ; then > # Remove existing rules > echo "/$scsilink/d >w >q >" | ed $RULE > /dev/null 2>&1 > [ "$remove_only" = 1 ] && exit 0 > # And create a new one > cat >> $RULE <<EOF >ACTION=="add", KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="scsi", ENV{ID_SERIAL}=="$scsilink", RUN+="/bin/bash -c 'echo 0 $blksize linear \$major:\$minor 0 | /sbin/dmsetup create \$env{ID_BUS}-\$env{ID_SERIAL} -u linear-\$env{ID_BUS}-\$env{ID_SERIAL}'" >EOF >fi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 397816
:
220616
|
221461
|
221467
|
221468
|
221471
|
221792
|
221793
| 227827 |
228274