From: Milan Broz <mbroz@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Sanjana Shari <sanjana.linux@gmail.com>
Subject: Re: creating two device mapper files for an underline blockdevice
Date: Tue, 01 Nov 2011 09:31:54 +0100 [thread overview]
Message-ID: <4EAFAE7A.7060000@redhat.com> (raw)
In-Reply-To: <CABMcfaMVsagfFdtg+f1eYR501wWSMbxsEAHTYD_5MTF1bABu0A@mail.gmail.com>
On 11/01/2011 07:08 AM, Sanjana Shari wrote:
> But if I use the other part of the disk to map. The command is not successful
>
> [root@bladelinux01 root]# dmsetup create half1 --table "102401 102399 linear /dev/loop0 102400"
> device-mapper: reload ioctl failed: Invalid argument
> Command failed
You have to always map the whole table (starting at sector 0).
If you see syslog, you can see why
device-mapper: table: 254:2: linear: Gap in table
device-mapper: ioctl: error adding target to table
Anyway, for the info how it works, example how to switch active table:
1. create linear device mapped to /dev/sdb
# dmsetup create x --table "0 10000 linear /dev/sdb 0"
# dmsetup table x
0 10000 linear 8:16 0
2. Remap the first half of device to another target, here "error"
- load new (yet inactive) table
# echo -e "0 5000 error\n5000 10000 linear /dev/sdb 5000" | dmsetup load x
- so now you have one active table and one inactive (prepared for switch)
# dmsetup table x
0 10000 linear 8:16 0
# dmsetup table x --inactive
0 5000 error
5000 10000 linear 8:16 5000
3. switch to new (inactive) table (note that "dmsetup suspend" here is implicit)
# dmsetup resume x
# dmsetup table x
0 5000 error
5000 10000 linear 8:16 5000
If you want more info about this low level DM operation, read
http://people.redhat.com/agk/talks/FOSDEM_2005/
http://mbroz.fedorapeople.org/talks/DeviceMapperBasics/
(old, but still useful, I hope :-)
Milan
next prev parent reply other threads:[~2011-11-01 8:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 6:08 creating two device mapper files for an underline blockdevice Sanjana Shari
2011-11-01 6:10 ` Sanjana Shari
2011-11-01 8:31 ` Milan Broz [this message]
2011-11-01 16:52 ` Sanjana Shari
2011-11-01 17:10 ` Sanjana Shari
2011-11-02 7:57 ` Milan Broz
2011-11-02 12:32 ` Sanjana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EAFAE7A.7060000@redhat.com \
--to=mbroz@redhat.com \
--cc=dm-devel@redhat.com \
--cc=sanjana.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.