Z
Z
Zhmak2019-04-19 11:55:05
Debian
Zhmak, 2019-04-19 11:55:05

Why can't parted delete a partition?

There is a device /dev/mapper/6_web created by multipathd
. It has a GPT partition on it:

partprobe -d -s /dev/mapper/6_web
/dev/mapper/6_web: gpt partitions 2

I'm trying to remove it:
parted /dev/mapper/6_web
(parted) print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/6_web: 1207GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system  Name  Flags
 2      121GB  181GB  60.3GB  ext3         2

(parted) rm 2
Error: Partition /dev/mapper/6_webp2 is being used. You must unmount it before you modify it with Parted.

It would seem that it is necessary to unmount. But:
umount  /dev/mapper/6_webp2
umount: /dev/mapper/6_webp2: not mounted

In LVM, this volume is also not seen.
What is holding him?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
Zhmak, 2019-04-22
@Zhmak

Shalil Device Mapper. Parted was buggy.
Removed partition from /dev/mapper/6_webp2 via gdisk

gdisk /dev/mapper/6_web
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/mapper/6_web: 2357198848 sectors, 1.1 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 75A8F088-8F7F-4127-B809-F458AAE91D57
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 2357198814
Partitions will be aligned on 2048-sector boundaries
Total free space is 2239340477 sectors (1.0 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2       235720704       353579007   56.2 GiB    0700  2

Command (? for help): d 2
Using 2

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mapper/6_web.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.

Wherein:
parted /dev/mapper/6_webp2
GNU Parted 2.3
Using /dev/mapper/6_webp2
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/6_webp2: 60.3GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  60.3GB  60.3GB  ext3

Device mapper spawned it,
dmsetup info /dev/mapper/6_webp2
Name:              6_webp2
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 2
Number of targets: 1

he will kill her:
Check:
dmsetup info /dev/mapper/6_webp2
Device does not exist.
Command failed

Checking the open count of 6_web:
dmsetup info /dev/mapper/6_web
Name:              6_web
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      1
Major, minor:      253, 1
Number of targets: 1
UUID: mpath-360080e500029f9a00000142d5c51434e

And here's the surprise:
ls /dev/mapper/ | grep 6_web
6_web  6_webp2

But dmsetup ls says everything is fine:
dmsetup ls
6_web   (253:1)
... и прочие, не связанные с ним

S
sash999, 2019-04-19
@sash999

sudo lsof | grep -E "/dev/mapper/6_webp2"

I
Ingvar, 2019-04-19
@take

maybe because of /dev/mapper ?
"The devices in /dev/mapper are Logical Volumes. These are virtual block devices carved out of storage space allocated to one or more Volume Groups. The Volume Groups in turn are created from a number of Physical Volumes, which can be entire block devices or partitions."
in general, if I am not mistaken, it is necessary to delete the record of its membership in LVM - LVMa may no longer be, but GPT - says that it is ... and does not. Such an idea.
One more --> zfs ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question