You are not logged in.

#1 2014-12-04 19:06:48

SteveSapolsky
Member
Registered: 2014-08-09
Posts: 16

[SOLVED] View partitions on a luks device

The problem:

I have a partitioned `/dev/mapper/cryptroot` , but partitions cryptroot1 and cryptroot2 are not visible. How can I make them visible so that I could mount them or mkfs on them.

The solution:

partprobe /dev/mapper/cryptroot

Explanation:
jjacky wrote:

With what you're doing, writing a new partition table on /dev/mapper/2T (if I got it right), of course after opening the LUKS container it "doesn't work" : as far as the kernel goes/knows this is one device, where you need/want devices for each partition. You'd need to do something like `partprobe /dev/mapper/2T` which should "set up" those 2 devices and you should then be able to mount your filesystems normally, using /dev/mapper/2T{1,2}.
But then when you're done, after umounting them I think you'll need to use `dmsetup remove` on each one, before you can luksClose your container.

Additional info about the problem

`/dev/mapper/cryptroot` is a LUKS device mapped from `/dev/sdb3` using `cryptsetup open /dev/sdb3 cryptroot`. I'm running from a live CD. `/dev/mapper/cryptroot` has two partitions that were partitioned using `gdisk`. The partition table type is GTP.

`fdisk -l` shows `cryptroot1` and 2.

 
	

    [root@arch Desktop]# fdisk -l
     
    Disk /dev/sda: 19.7 GiB, 21156397056 bytes, 41321088 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
     
    Disk /dev/sdb: 40 GiB, 42949672960 bytes, 83886080 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 334649F7-4972-46BC-AD43-6BD74E1D5EF1
     
    Device           Start          End   Size Type
    /dev/sdb1         2048         6143     2M Microsoft basic data
    /dev/sdb2         6144       415743   200M Microsoft basic data
    /dev/sdb3       415744     83884031  39.8G Microsoft basic data
     
     
    Disk /dev/mapper/cryptroot: 39.8 GiB, 42733666304 bytes, 83464192 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 4CB78201-D7F9-45FE-BFA1-FD9C6433D01F
     
    Device                        Start          End   Size Type
    /dev/mapper/cryptroot1         2048     16779263     8G Linux swap
    /dev/mapper/cryptroot2     16779264     83464158  31.8G Linux filesystem


 

However, when I try to

mount /dev/mapper/cryptroot2 /mnt/cryptroot

it does not work, because it says that "special device /dev/mapper/cryptroot2 does not exists"

`ls /dev/mapper/`  only shows `@cryptroot`

How can I make the cryptroot2 visible after partitioning it with `gdisk`?

I know that I can use LVM and partitions would be visible immediately. But using LVM just to make a separate swap partition (which is cryptroot1) seemed like an overkill, especially considering that I'll be using btrfs for volume management on cryptroot2.

Last edited by SteveSapolsky (2014-12-05 13:38:35)

Offline

#2 2014-12-04 20:29:11

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: [SOLVED] View partitions on a luks device

Offline

#3 2014-12-05 13:31:50

SteveSapolsky
Member
Registered: 2014-08-09
Posts: 16

Re: [SOLVED] View partitions on a luks device

Thank you. It works. I edited my original post and added the solution.

I'm curious whether there are any advantages when partitioning a LUKS device vs using LVM, if LVM features won't be used (partitions will have a fixed size). There does not seem to be any, so adding an extra layer of abstraction like LVM seemed unnecessary.

Last edited by SteveSapolsky (2014-12-05 13:41:01)

Offline

Board footer

Powered by FluxBB