Use of device mapper

Source: Internet
Author: User

Http://www.ibm.com/developerworks/cn/linux/l-devmapper/index.html

This page introduces some principles. You can take a look.

Dmsetup command

Displays information about the current device mapper.

Dmsetup ls

Dmsetup info

Dmsetup status

Display Device Dependencies

Dmsetup deps

Sda4_crypt: 1 dependencies: (8, 4)
Vg_richard-lv_home: 1 dependencies: (253, 0)
Vg_richard-lv_swap: 1 dependencies: (253, 0)
Vg_richard-lv_root: 1 dependencies: (253, 0)

Let's take a look at the files under/dev.

Brw-rw ---- 1 root disk 8, 4 2012-09-03 09:16 sda4

Brw-rw ---- 1 root disk 253, 0 2012-09-03 dm-0
Brw-rw ---- 1 root disk 253, 1 2012-09-03 dm-1
Brw-rw ---- 1 root disk 253, 2 2012-09-03 dm-2
Brw-rw ---- 1 root disk 253, 3 2012-09-03 dm-3

That is, sda4_crypt depends on sda4.

Vg_ricard-lv_home depends on dm-0

Show table information

Dmsetup table

Create a linear device

Dmsetup create dm-name dm-table

Dm-name is the name of the device to be created. If it succeeds, the file with this name will be generated in the/dev/mapper/directory.

Dm-table stores the mapping table of the map device.

An example of a Simple dm-table is as follows:

Number of start slice slices linearly map the start slice on the target device

0 1025 linear/dev/sdb2 0

1025 1025 linear/dev/sdc2 0

The sector size of a block can be obtained using blockdev -- getsize/dev/sdb2.

If the disk is just partitioned, use partprobe to update it.

View the write sequence of the linear device

Create a file system for the newly generated device and mount it to a directory.

Cd to this directory, run

Dd if =/dev/zero of = test

This command will run until the disk is fully written.

Run before running

Watch-n 1 iostat/dev/sdb2/dev/sdc2

To observe the disk read/write status.

It can be found that the write process is: first write to/dev/sdb2, then write to/dev/sdc2.

This process is consistent with the concept of linear.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.