# where are the rest of my partitions?

## curmudgeon

Lots of stuff I have not worked with before (gdisk, lvm).

```

Command (? for help): p

Disk /dev/mapper/disk: 732566133 sectors, 2.7 TiB

Logical sector size: 4096 bytes

Disk identifier (GUID): xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx

Partition table holds up to 128 entries

First usable sector is 6, last usable sector is 732566127

Partitions will be aligned on 256-sector boundaries

Total free space is 250 sectors (1000.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name

   1             256        16777471   64.0 GiB    8300  01

   2        16777472        33554687   64.0 GiB    8300  02

   3        33554688        50331903   64.0 GiB    8300  03

   4        50331904        67109119   64.0 GiB    8300  04

   5        67109120        83886335   64.0 GiB    8300  05

   6        83886336       100663551   64.0 GiB    8300  06

   7       100663552       117440767   64.0 GiB    8300  07

   8       117440768       134217983   64.0 GiB    8300  08

   9       134217984       150995199   64.0 GiB    8300  09

  10       150995200       167772415   64.0 GiB    8300  10

  11       167772416       184549631   64.0 GiB    8300  11

  12       184549632       201326847   64.0 GiB    8300  12

  13       201326848       218104063   64.0 GiB    8300  13

  14       218104064       234881279   64.0 GiB    8300  14

  15       234881280       251658495   64.0 GiB    8300  15

  16       251658496       268435711   64.0 GiB    8300  16

  17       268435712       285212927   64.0 GiB    8300  17

  18       285212928       301990143   64.0 GiB    8300  18

  19       301990144       318767359   64.0 GiB    8300  19

  20       318767360       335544575   64.0 GiB    8300  20

  21       335544576       352321791   64.0 GiB    8300  21

  22       352321792       369099007   64.0 GiB    8300  22

  23       369099008       385876223   64.0 GiB    8300  23

  24       385876224       402653439   64.0 GiB    8300  24

  25       402653440       419430655   64.0 GiB    8300  25

  26       419430656       436207871   64.0 GiB    8300  26

  27       436207872       452985087   64.0 GiB    8300  27

  28       452985088       469762303   64.0 GiB    8300  28

  29       469762304       486539519   64.0 GiB    8300  29

  30       486539520       503316735   64.0 GiB    8300  30

  31       503316736       520093951   64.0 GiB    8300  31

  32       520093952       536871167   64.0 GiB    8300  32

  33       536871168       553648383   64.0 GiB    8300  33

  34       553648384       570425599   64.0 GiB    8300  34

  35       570425600       587202815   64.0 GiB    8300  35

  36       587202816       603980031   64.0 GiB    8300  36

  37       603980032       620757247   64.0 GiB    8300  37

  38       620757248       637534463   64.0 GiB    8300  38

  39       637534464       654311679   64.0 GiB    8300  39

  40       654311680       671088895   64.0 GiB    8300  40

  41       671088896       687866111   64.0 GiB    8300  41

  42       687866112       704643327   64.0 GiB    8300  42

  43       704643328       721420543   64.0 GiB    8300  43

  44       721420544       732566127   42.5 GiB    8300  44

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/disk.

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.

# partprobe

# ls -al /dev/mapper/

total 0

drwxr-xr-x  2 root root      420 2014-04-25 17:27:26 ./

drwxr-xr-x 17 root root     5600 2014-04-25 17:27:26 ../

crw-------  1 root root  10, 236 2013-12-11 23:15:05 control

lrwxrwxrwx  1 root root        7 2014-04-25 17:39:07 disk -> ../dm-0

brw-------  1 root root 253,   2 2014-04-25 17:27:26 diskp1

brw-------  1 root root 253,  11 2014-04-25 17:27:26 diskp10

brw-------  1 root root 253,  12 2014-04-25 17:27:26 diskp11

brw-------  1 root root 253,  13 2014-04-25 17:27:26 diskp12

brw-------  1 root root 253,  14 2014-04-25 17:27:26 diskp13

brw-------  1 root root 253,  15 2014-04-25 17:27:26 diskp14

brw-------  1 root root 253,  16 2014-04-25 17:27:26 diskp15

brw-------  1 root root 253,  17 2014-04-25 17:27:26 diskp16

brw-------  1 root root 253,   3 2014-04-25 17:27:26 diskp2

brw-------  1 root root 253,   4 2014-04-25 17:27:26 diskp3

brw-------  1 root root 253,   5 2014-04-25 17:27:26 diskp4

brw-------  1 root root 253,   6 2014-04-25 17:27:26 diskp5

brw-------  1 root root 253,   7 2014-04-25 17:27:26 diskp6

brw-------  1 root root 253,   8 2014-04-25 17:27:26 diskp7

brw-------  1 root root 253,   9 2014-04-25 17:27:26 diskp8

brw-------  1 root root 253,  10 2014-04-25 17:27:26 diskp9

```

So what happened to diskp17 to diskp44?

----------

## eccerr0r

I think there is a sort of limit of 15 partitions per physical disk due to minor number distribution.  You might want to look into LVM which I don't think has this limit - create one large gpt partition on the disk and then make your small 64G logical volumes.

----------

## srs5694

The limit varies depending on system settings. I'm afraid I don't recall the details. I have tested with huge numbers of partitions, though, and some distributions are able to see them all "out of the box" whereas others can't. Unfortunately, it's been a while since I did my tests, and I don't recall the details of what worked and what didn't.

----------

## curmudgeon

 *eccerr0r wrote:*   

> I think there is a sort of limit of 15 partitions per physical disk due to minor number distribution.

 

I thought those limits were removed ages ago.

 *eccerr0r wrote:*   

> You might want to look into LVM which I don't think has this limit - create one large gpt partition on the disk and then make your small 64G logical volumes.

 

It is LVM (which I did mention).

I encrypted the entire hard drive, and then partitioned the LVM mapping:

```

cryptsetup -v luksFormat /dev/sdx

cryptsetup open /dev/sdx disk

gdisk /dev/mapper/disk

```

----------

## NeddySeagoon

curmudgeon,

Its not really LVM.

You have created an encrypted container, than made real partitions in the partition table (not logical volumes) within the container.

You need to donate /dev/mapper/disk to LVM then divide it up using lvcreate.  That way you don't use the partition table in /dev/mapper/disk and get all the other benefits of logical volumes.

This is an extra layer of LVM that you don't need.  You can make a single partition on the disk, encrypt that then donate the encrypted volume to LVM.

You can also do the same thing with the whole disk but then there is no partition table, nor space for a boot record, so you can't boot from it.

----------

## curmudgeon

 *NeddySeagoon wrote:*   

> You have created an encrypted container, than made real partitions in the partition table (not logical volumes) within the container.

 

I understand that.

 *NeddySeagoon wrote:*   

> You need to donate /dev/mapper/disk to LVM then divide it up using lvcreate.  That way you don't use the partition table in /dev/mapper/disk and get all the other benefits of logical volumes.

 

I can't do that for policy (legal) reasons. I need multiple storage areas on the drive that are physically separate. Having them combined into one large storage pool is an absolute no-no for this project.

 *NeddySeagoon wrote:*   

> This is an extra layer of LVM that you don't need.  You can make a single partition on the disk, encrypt that then donate the encrypted volume to LVM.
> 
> You can also do the same thing with the whole disk but then there is no partition table, nor space for a boot record, so you can't boot from it.

 

Booting from the disk is not a concern. It is going to store (sensitive) data. It seems there are dozens of tutorials about how to set up a system disk using LVM, but none about how to set it up in a way that meets my requirements. My latest plan was actually to use zfs, because I can understand how to set up pools from the partitions. I could even do a fake raid with zfs (it could protect against one area of the disk going bad, and that is actually the type of hard drive failures I have been encountering recently), though I would worry that that would stress out the hard drive because every write would use multiple areas of the drive (performance is not an issue).

I seem to have completely lost control of what I have done:

```

# cryptsetup close /dev/mapper/disk

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

device-mapper: remove ioctl on disk failed: Device or resource busy

Device /dev/mapper/disk is still in use.

# ls -al /dev/mapper/

total 0

drwxr-xr-x  2 root root      420 2014-04-25 17:27:26 ./

drwxr-xr-x 17 root root     5600 2014-04-26 05:17:18 ../

crw-------  1 root root  10, 236 2013-12-11 23:15:05 control

lrwxrwxrwx  1 root root        7 2014-04-25 17:39:07 disk -> ../dm-0

brw-------  1 root root 253,   2 2014-04-25 17:27:26 diskp1

brw-------  1 root root 253,  11 2014-04-25 17:27:26 diskp10

brw-------  1 root root 253,  12 2014-04-25 17:27:26 diskp11

brw-------  1 root root 253,  13 2014-04-25 17:27:26 diskp12

brw-------  1 root root 253,  14 2014-04-25 17:27:26 diskp13

brw-------  1 root root 253,  15 2014-04-25 17:27:26 diskp14

brw-------  1 root root 253,  16 2014-04-25 17:27:26 diskp15

brw-------  1 root root 253,  17 2014-04-25 17:27:26 diskp16

brw-------  1 root root 253,   3 2014-04-25 17:27:26 diskp2

brw-------  1 root root 253,   4 2014-04-25 17:27:26 diskp3

brw-------  1 root root 253,   5 2014-04-25 17:27:26 diskp4

brw-------  1 root root 253,   6 2014-04-25 17:27:26 diskp5

brw-------  1 root root 253,   7 2014-04-25 17:27:26 diskp6

brw-------  1 root root 253,   8 2014-04-25 17:27:26 diskp7

brw-------  1 root root 253,   9 2014-04-25 17:27:26 diskp8

brw-------  1 root root 253,  10 2014-04-25 17:27:26 diskp9

# ls -al /dev/dm-*

brw-rw---- 1 root disk 253,  1 2014-04-25 17:39:07 /dev/dm-0

brw-rw---- 1 root disk 253, 11 2014-04-25 17:27:28 /dev/dm-10

brw-rw---- 1 root disk 253, 12 2014-04-25 17:27:28 /dev/dm-11

brw-rw---- 1 root disk 253, 13 2014-04-25 17:27:27 /dev/dm-12

brw-rw---- 1 root disk 253, 14 2014-04-25 17:27:28 /dev/dm-13

brw-rw---- 1 root disk 253, 15 2014-04-25 17:27:28 /dev/dm-14

brw-rw---- 1 root disk 253, 16 2014-04-25 17:27:28 /dev/dm-15

brw-rw---- 1 root disk 253, 17 2014-04-25 17:27:28 /dev/dm-16

brw-rw---- 1 root disk 253,  2 2014-04-25 17:27:28 /dev/dm-1

brw-rw---- 1 root disk 253,  3 2014-04-25 17:27:27 /dev/dm-2

brw-rw---- 1 root disk 253,  4 2014-04-25 17:27:27 /dev/dm-3

brw-rw---- 1 root disk 253,  5 2014-04-25 17:27:28 /dev/dm-4

brw-rw---- 1 root disk 253,  6 2014-04-25 17:27:28 /dev/dm-5

brw-rw---- 1 root disk 253,  7 2014-04-25 17:27:28 /dev/dm-6

brw-rw---- 1 root disk 253,  8 2014-04-25 17:27:28 /dev/dm-7

brw-rw---- 1 root disk 253,  9 2014-04-25 17:27:28 /dev/dm-8

brw-rw---- 1 root disk 253, 10 2014-04-25 17:27:27 /dev/dm-9

# rm /dev/dm-*

# rm /dev/mapper/disk*

# ls -al /dev/mapper/

total 0

drwxr-xr-x  2 root root      60 2014-04-26 12:12:35 ./

drwxr-xr-x 17 root root    5240 2014-04-26 12:12:03 ../

crw-------  1 root root 10, 236 2013-12-11 23:15:05 control

# cryptsetup close /dev/mapper/disk

Device /dev/mapper/disk is not active.

# cryptsetup open /dev/sdx disk

Device disk already exists.

# /etc/init.d/device-mapper stop

 * WARNING: you are stopping a boot service

# /etc/init.d/device-mapper status

 * status: stopped

# /etc/init.d/device-mapper start

# /etc/init.d/device-mapper status

 * status: started

# ls -al /dev/mapper/

total 0

drwxr-xr-x  2 root root      60 2014-04-26 12:12:35 ./

drwxr-xr-x 17 root root    5240 2014-04-26 12:17:02 ../

crw-------  1 root root 10, 236 2013-12-11 23:15:05 control (notice old time stamp)

# cryptsetup open /dev/sdx disk

Device disk already exists.

# cryptsetup close /dev/mapper/disk

Device /dev/mapper/disk is not active.

# rm /dev/mapper/control

# /etc/init.d/device-mapper stop

 * WARNING: you are stopping a boot service

# /etc/init.d/device-mapper start

# cryptsetup open /dev/sdx disk

Device disk already exists.

# cryptsetup close /dev/mapper/disk

Device /dev/mapper/disk is not active.

# cryptsetup open /dev/sdx foo

Enter passphrase for /dev/sdx: 

Cannot use device /dev/sdx which is in use (already mapped or mounted).

```

How do I completely reset this? I loooked through various directories in /run and /var (and the output of lsof), and couldn't figure out where the mapping is being stored.

----------

