1

I've shrinked my /home from 2.7TB to 100G, I've extended /root, /usr, /tmp and /var but I have been looking for a way to create an /opt partition for 3 hours now, and can't find it.

The setup is 3TB luks encrypted partition on /dev/sdb3(container) inside it are my lvm partitions /root, /usr, /tmp, /var and /home in a Debian Wheezy system.

I used lvreduce, lvextend, e2fsck and resize2fs from a booted live cd to change to current partitions. With directions from tutorials and webpages, like this is one.

How do I create an /opt partition 23G from the unused space on /dev/sdb3?

I've tried this:

lvcreate -L 23G -n opt Group

I don't understand this enough to find the right command, here is the output:

/dev/group/opt: not found: device not cleared
Aborting: Failed to wipe start of new LV

EDIT #1

Here is fdisk -l

Disk /dev/sdb: 3000.6 GB, 30005929282016 bytes

Device Boot       start          end           Blocks     Id system
/dev/sdb1           1            4294967295   2147483647+ ee  GPT

Disk /dev/mapper/crypt1: 3000.3 GB 3000332451840 bytes
255 heads, 63 sectors/track, 364769 cylinders, total 58600024320 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/0 size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/group-root: 5716MB, 5716836352 bytes

Disk /dev/mapper/group-usr: 105,6 GB

Disk /dev/mapper/group-var: 10.5 GB

Disk /dev/mapper/group-swap 8048MB

Disk /dev/mapper/group-tmp 7914MB

Disk /dev/mapper/goup-home 107.4GB

Here is parted /dev/sdb print devices:

/dev/sdb (3001GB)
/dev/mapper/group-tmp (7915MB)
/dev/mapper/group-swap (8049MB)
/dev/mapper/group-home (107GB)
/dev/mapper/group-var (10.5GB)
/dev/mapper/group-usr (106GB)
/dev/mapper/group-root (5717MB)
/dev/mapper/crypt1 (3000GB)

Here is parted /dev/sdb print free:

Model: ATA TOSHIBA (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 5128/4096B
Partition Table: gpt

Number  start         end      Size         File system   Name   Flags
        17.4kb      1049kb    1031kb         Free space
1       1049kb      2097kb    1049kb                         bios_grub
2       2097kb      258MB     256MB          ext2
3       258MB       3001GB    3000GB
        3001GB      3001GB    466kb          Free space

EDIT #2

Here is vgdisplay:

---- Volume group -----
VG Name           Group
SystemID
Format             lvm2
Metadata Areas        1
Metadata Sequence No 18
VG Access       read/write
VG Status       resizable
MAX LV                0
Cur LV                6
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size             2.73 TiB
PE Size             4.00 MiB
Total PE            715334
Alloc PE / Size     58461 / 228.36 GiB
Free PE / Size      656873 / 2.51 TiB
VG UUID             239082309572039572039
  • Maybe I'm missing something obvious. You say /dev/sdb3 is LUKS encrypted, but not what the LUKS container actually contains. Is that part of the LVM setup? Or is it currently not used for anything at all? – a CVn Mar 17 '15 at 22:30
  • @MichaelKjörling You have to excuse my little-know but I don't fully understand lvm yet. But as I understand it there is sdb which has sdb3 which is encrypted and inside that is my lvm with these partitions, where I want to add an /opt partition to lvm. If I shrink my /home from 2.7TB to 100G there should be alot of free space inside this sdb3. Or maybe I'm just rambling. – somethingSomething Mar 17 '15 at 22:36
  • So /dev/sdb3 is a LUKS container which in turn holds your LVM container (within which you created the LVs for various file systems), correct? – a CVn Mar 17 '15 at 22:37
  • 1
    Google suggests that adding -Z n to the lvcreate command might make the problem go away. If that fails please re-run the lvcreate command with a triple verbose flag, lvcreate -vvv ... – roaima Mar 18 '15 at 0:04
  • 1
    Ahh....asked for the verbose output....vgdisplay -v group – mdpc Mar 18 '15 at 0:13
1

The apparent answer is to run these two commands

lvcreate --name opt --size 23Gi group
mkfs -t ext4 -L opt /dev/group/opt

However, via the comments thread it became apparent that lvcreate threw an error message,

/dev/group/opt: not found: device not cleared
Aborting: Failed to wipe start of new LV

A search on Google finds that this is a known error, and the suggested workaround is to avoid zeroing the first part of the LV by using lvcreate --zero n ....

I've done some more investigation and it appears that lvcreate will work fine once udev is restarted (either via a system reboot or with udevadm reload). I would surmise that the /dev/{volumegroup} node is simply not being created, and so lvcreate can't find it.

(Answer extracted from the comments thread)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.