Resizing a logical partition with a LUKS container

I have a logical partition that contains LUKS which holds an LVM2 schema.  My goal is to resize the existing logical partition so I can create other partitions in their own LUKS-encrypted container.  So far, the LVM2 PV is resized and I'm looking for advice on how to handle shrinking the LUKS container and the logical partition it lives on.
I heard rumors that LUKS containers don't need to be resized and that I can change the size of the block device it lives on without problems.  Is this true?  If so, it seems like I should be able to delete the logical partition and replace it with a smaller one as usual.  How can I calculate the blocks/sectors/etc for the new partition with the LUKS & LVM2 data on there?
Last edited by synthead (2013-02-16 07:42:02)

Running into a new problem:
# fdisk /dev/sda
Welcome to fdisk (util-linux 2.22.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 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 identifier: 0x0005c24e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 250068991 124783617 5 Extended
/dev/sda5 501760 250068991 124783616 83 Linux
Command (m for help): d
Partition number (1-5): 5
Partition 5 is deleted
Command (m for help): p
Disk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 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 identifier: 0x0005c24e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 250068991 124783617 5 Extended
Command (m for help): n
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (503806-250068991, default 503808): 501760
Value out of range.
Why can't I create a partition on the same starting sector as before?

Similar Messages

  • Dynamic resize of FAT32 partition with disk utility?

    Hi there.
    I have a 1TB external FAT32 drive with 300GB of data on it.
    I want to convert it to HFS+, but I know there's no easy way to do that.
    What I want to know is can I resize my FAT32 partition to 500MB and keep all the data?
    Then I'll move it to the new HFS+ 500MB partition, delete the original partition and resize the HFS+ partition.
    Or do I have no hope of that?
    Thanks
    Greg

    Greg,
    You're probably out of luck on this one. If the drive was partitioned and formatted by a PC (every drive has a partition map, whether there are multiple partitions or only one), it almost certainly has an "MBR" partition map. This would preclude a dynamic resizing by Disk Utility. It will need to be partitioned using either GUID (Intel) or APM (PPC).
    Scott

  • Disk utility fails to resize portable drive partitions with error message "requested change in size is too small".

    I am using a 1TB WD studio passport portable drive with my 2011 MacBook Pro. I have the portable drive partitioned into 4 volumes: 355 GB, 320 GB, 320 GB, & 4 GB.  But Disk Utility won't allow me to split the third of those into 160 GB /160 GB.  All volumes verify as seeming "to be okay".  Seems if Disk Utility could create me a 4GB partition that 160 GB is plenty big enough, right?  Something's not right; Can you help me with this please?

    What is on those partitions and or the partition you want to split in two?
    If you don't have any data on partitions or if you can save it someplace else for the time being then why not just Re-Partition the whole drive into the sizes you now want.

  • I was trying to resize my bootcamp partition and it got deleted now I have 217 GB of free space that I cant use and I want to rejoin it with my macbook partiton.

    So I was trying to resize my bootcamp partition with Paragon and it was taking forever so I decided to use iPartition the Paragon started doing something and it was almost done when my macbook began to shut down. It was shutting down becuase I though the paragon wouldnt work. Anyway it shut down and I wasnt able to boot to the iPartition CD, so I decided to just screw it and just stick with Mac osx. Then while in the iPartition app once I booted up back into OSX it said I had 217 gigs of free space and my hardrive/mac os partition can only use like 270 gigs. But I desparetely need these 215 gigs back becuase I do things that require alot of memory. Does anybody have any idea how I can rejoin this free space with my mac partition. I already tried it in disk utility and it kept failing with a couldnt unmount disk error everytime I tried to resize back to its full size! PLEASE HELP! Heres a pic of what iPartiton shows me.

    You need an external disk that is formated as HFS+ with a GUID partition map.
    You can use either Carbon Copy Cloner or SuperDuper to create the clone.
    Once ypu have the clone you can boot from my holding down the option key ater power on.
    Once booted from the clone open Disk Utility.
    Select the internal drive.
    Click partition.
    Select single partition.
    Once drive has bee formated, restore the clone nack with the application used to make the original clone.
    Boot from internal drive.
    Allan

  • Windows 7 won't boot after adding a third partition with gparted

    I needed extra space on my bootcamp partition so I :
    1. resized macintosh hd partition with disk utility
    2.booted with gparted live disk and "growed" the bootcamp partition
    Now Windows doesn't boot. Any suggestions?

    Hi,
    your Topic says '...adding a third partition' whereas in your message you don't mention this third partition...
    So what is the right one ?
    Nonetheless you might have a look at EasyBCD http://neosmart.net/dl.php?id=1 to repair the Windows 7 bootloader.
    Regards
    Stefan

  • Logical Partitioning Practical Implementation

    Hi All,
    Has anyone migrated from existing 2 partitions of CUG and PSTN lines to Logical partitioning with Single Line?
    If yes, can you please provide me with some real information regarding the same. I have read the configuration guides and understood the technology but confused with how to implement it practically for one of our customer.
    Any help would be highly appreciable.
    Thanking in anticipation.
    Regards,
    Amitkumar Patel.

    Thanks all. I was able to find the solution for my scenario..

  • Geolocation (Logical Partition) on Mobility with Smartphones

    Hello
    We have a new project coming up and the primary requirement is Smartphone Integration with CUCM. (Nokia, Iphone and Android Phones)..
    This project will be deployed in India and now my concern is, since here in India there are DOT regulations for TEHO.
    When I configure a Smartphone to integrate with CUCM, if this smartphone user tries to make a call to another IP phone extension at a different location over the WAN and while this call is on, if he conference this with a local PSTN number from his VOIP line on the smartphone then this is going to be a violation.
    To avoid this problem in India, I know Cisco introduced the Geolocation (Logical partition feature).
    But do these smart phones support the Geolocation configuration.
    I read in the release notes of CUCM that
    " Logical partitioning handling does not take place in the following circumstances:
    • Geolocation or geolocation filter does not associate with the involved devices.
    • No logical partitioning support exists when a dual-mode phone is used. "
    Can you help me with a confirmation on this and if possible a better solution to ensure no violation of any regulation while using Smartphone as IP Phone extensions.
    Thanks in Advance
    Abraham Sebastian

    Windows 8.1 can run on either partition. The biggest issue with MBR over GPT is that MBR is limited to the size od disks supported. 4 partitions of up to 2TB max. GPT has a theoretical limit of 9.4 Zettabytes (10 Billion TB). You may also run into a problem if you are dual booting (or more). If neither of those two things concern you, then just leave well enough alone. About the Virtual hard drive, do you really need them? They will just eat up more space on the real harddrive. Are you going to use a Virtual machine?
    Hoov
    Microsoft MVP - Consumer Security
    SpywareHammer.com

  • I erased my windows partition using disk utility then realized I should have used boot camp, because now I can't resize the original partition and seem to be stuck with a ghost unusable space. Boot Camp now doesn't give me the option to install or re

    I erased my windows partition using disk utility then realized I should have used boot camp, because now I can't resize the original partition and seem to be stuck with a ghost unusable space. Boot Camp now doesn't give me the option to install or remove windows partition.

    Hi, Ralph,
    The problem is that I did erase the partition, using disk utility, but I can't go back to my original disk size pre-partition, as disk utility won't let me do it and gives the message "Couldn’t modify partition map because file system verification failed." When I try to use Boot Camp Assistant it won't let me select the third option to remove windows.

  • Cannot resize Time Machine partition

    Hello all,
    I currently have a hard drive split into 2 partitions (both Mac OS Extended (Journaled)). One of the Time Machine partitions is far too big (for the backups it contains) and I want to reclaim some space as a regular data partition (for my windows PC). Unfortunately I can find no way to resize the existing partitions. There is no "corner to drag" in my disk utility. 617GB are free in the 697GB partition.

    Time Machine likes to be the first partition, otherwise it will continually ask you where?
    http://www.techrepublic.com/blog/apple-in-the-enterprise/how-to-resize-a-live-pa rtition-in-snow-leopard-and-lion/#.
    http://osxdaily.com/2009/11/20/resize-partitions-in-mac-os-x-with-disk-utility/

  • Physical Vs Logical Partitioning

    We have 2 million records in the sales infocube for 3 years. We are currently discussing the pros and cons of using Logical partitioning Vs Physical Partitioning. Please give your inputs.

    hi
    there are two types of partitioning generally talked about with SAP BW, logical and physical partitioning.
    Logical partitioning - instead of having all your data in a single cube, you might break into separate cubes, with each cube holding aspecific year's data, e.g. you could have 5 sales cubes, one for each year 2001 thru 2005.
    You would then create a Multi-Provider that allowed you to query all of them together.
    A query that needs data from all 5 years would then automatically (you can control this) be split into 5 separate queries, one against each cube, running at the same time. The system automatically merges the results from the 5 queries into a single result set.
    So it's easy to see when this could be a benefit. If your queries however are primarily run just for a single year, then you don't receive the benefit of the parallel processing. In non-Oracle DBs, splitting the data like this may still be a benefit by reducing the amount of rows in the fact table that must be read, but does not provide as much value to an Oracle DB since Infocube queries are using a Star_Transformation.
    Physical Partitioning - I believe only Oracle and Informix currently support Range partitioning. This is a separately licensed option in Oracle.
    Physical partitioning allows you to split an Infocube into smaller pieces. The pieces, or partitions, can only be created by 0FISCPER or 0CALMONTH for an InfoCube (ODSs can be partitioned, but require a DBAs involvement). The DB can then take advantage of this partitioning by "pruning" partitions during a query, e.g. a query only needs data form June 2005
    The DB is smart enough to restrict the indices and data it will read to the June 2005 partition. This assumes your query restricts/filters on the partitioning characteristic. It can apply this pruning to a range of partitions as well, e.g. 0FISCPER 001/2005 thru 003/2005 would only look at the 3 partitions.
    It is NOTsmart enough, however, to figure out that if your restrict to 0FISCYEAR = 2005, that it should only read 000/2005 thru 016/2005 since 0FISCYEAR is NOT the partitioning characteristic.
    An InfoCube MUST be empty in order to physically partition it. At this time, there is no way to add additional partitions thru AWB, so you want to make sure that you create partitions out into the future for at least a of couple of years.
    If the base cube is partitioned, any aggregates that contain the partitioning characteristic (0CALMONTH or 0FISCPER) will automatically be partitioned.
    In summary, you need to figure out if you want to use physical or logical partitioning on the cube(s), or both, as they are not mutually exclusive.
    So you would need to know how the data will be queried, and the volume of data. It would make little sense to partition cubes that will not be very large.
    physical partitioning is done at database level and logical partitioning done at data target level.
    Cube partitioning with time characteristics 0calmonth Fiscper is physical partitioning.
    Logical partitioning is u partition ur cube by year or month that is u divide the cube into different cubes and create a multiprovider on top of it.
    logical Vs physical partitions ?

  • Two partitions with OSX how to get only one back

    I installed xp on my macbook and did not know it was service pack 1. Hours later I have two partitions on my macbook both with OSX now. How can I get my macbook back to one partition with OSX on it?


    Enlarging a volume
    If you have multiple volumes on a disk and one is running out of space, you may be able to enlarge it
    without losing any of its data.
    To enlarge a volume, you must delete the volume that comes after it on the disk, and then move the
    volume’s end point into the freed space. You can’t enlarge the last volume on a disk. You can see the
    order of the volumes in Disk Utility by selecting the disk, clicking Partition, and looking at the Volume
    Scheme list.
    All data on the deleted volume will be erased. Be sure to back up your disk’s data before you begin.
    To enlarge a volume:
    From the list at the left, select the disk that contains the volume you want to enlarge, and then click
    Partition.
    In the Volume Scheme list, select the volume beneath the volume you want to enlarge, and then click
    Delete〔-〕.
    The volume is immediately erased, leaving the space it formerly occupied available.
    Resize the volume.
    You can drag the divider at the bottom of the volume in the Volume Scheme list, or you can select the
    volume, and then enter a value in the Size field.
    If the enlarged volume doesn’t use all the space from the deleted volume, you can create new volumes
    in the unused space.
    To create a new volume, click Add〔+〕, select the new volume, and choose its name, format, and size.
    Click Apply.
    Disk Utility enlarges the volume and creates any new volumes.
    Kj ♞

  • Fatal error - bad logical partition 8 : enlarged logical partitions

    Hi,
    I am trying to install Arch after being an Ubuntu user for approximatley two years.
    I re-formatted my drive to create an ~20Gb space in an ext4 extended partition since my previous would not allow more than four primary partitions.
    I am trying to triple boot: Win XP, Ubuntu, and Arch.
    I had read that one swap space would work, however I seem to now have three!
    I partitioned ntfs for Win XP, then  Ubuntu root, Ubuntu Home, Swap (2Gb), then left ~20Gb for Arch.
    However the output from Gparted now states I have three swaps! I cannot install Arch due to the error message:
    'Fatal error - bad logical partition 8 : enlarged logical partitions overlap'
    Is there a way of resolving this without re-formatting everything again, since I have spend hours setting up Win XP and Ubuntu to how I want them.
    I only use Win XP to manage my ipod and use Ubuntu as my primary OS. However, I recently found that by setting up Arch will teach me a hell of a lot about Linux OS which is my goal.
    Thanks in advance!
    fdisk output:
    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048   112642047    56320000    7  HPFS/NTFS/exFAT
    /dev/sda2       112644094   976496639   431926273    5  Extended
    /dev/sda5       174086144   931846143   378880000   83  Linux
    /dev/sda6       931848192   935944191     2048000   82  Linux swap / Solaris
    /dev/sda7       935946240   976496639    20275200   83  Linux
    /dev/sda8       169897984   174079999     2091008   82  Linux swap / Solaris
    /dev/sda9       112644096   165707775    26531840   83  Linux
    /dev/sda10      165709824   169887743     2088960   82  Linux swap / Solaris

    Oh, ok then, that makes sense ... I don't know the reason to align partitions to cylinders but there must be a good reason, although even if they are not aligned it shouldn't be a big problem (at least gparted allows you to create unaligned partitions).
    Personally gparted is not my first choice when dealing with partitions, it already scared me _big time_ and even if linux doesn't complain about partitions not being in the order they are on disk some programs complain about that (and gparted does make a mess out of that) and even refuse to do anything before they fix that (partition magic for example, and I've never lost any data or even got scared when using it).
    Lately I have been doing it like this, create the partitions with cfdisk which leaves everything in a way no program complains, then I format the partitions with mkfs.whatever or I use gparted just to format the partitions, I've never had problems when doing things like that.
    The last time I've used gparted to resize partitions things went well but on another occasion it did make a huge mess out of the partition layout (there were ntfs partitions involved when it went wrong, and only ext3 when all went well) leaving me with a problem similar to what you have now, luckily testdisk came to the rescue but I reckon I was just lucky that time.
    I've learned my lesson, _always_ make backups or copy things to another disk, besides being probably faster (as gparted does a ton of checks) it is a lot safer and if you have really important stuff on your hard disk you can't afford to be relying on the chance of not loosing it in the process.

  • Merge physical and logical partitions

    How do I extend my physical arch partition with an unallocated space logical partition?
    I want to add an unallocated space logical partition to a physical partition
    or better said I want to grow my existing arch physical partition with the unallocated space logical partition.
    Last edited by karlzt (2010-03-20 15:50:31)

    It is not that easy. You can resize and/or move either physical partitions or locical partitions inside the space of the (physical) "extended partition". But you cannot simply take space from a logical partion and assign it to a physical partition adjacent to the extended partition it is part of. Which means you can extend a physical partion only from free space which you can produce by a prior shrinking/moving another adjacent physical partition.
    The problem is, I currently know of no way to shrink an extended partition without losing some of the enclosed logical partition data (or even all logical partions at once). One could try, as a proper backup is advisable in any case before messing around with partitions.

  • FATAL ERROR: Bad logical partition 6: enlarged logical partitions over

    I am trying to install Arch on my second computer, but I get this error in cfdisk:
    FATAL ERROR: Bad logical partition 6: enlarged logical partitions overlap.
    This is the output of fdisk -l:
    $ sudo fdisk /dev/sda -l
    Schijf /dev/sda: 500.1 GB, 500107862016 bytes
    255 koppen, 63 sectoren/spoor, 60801 cilinders
    Eenheid = cilinders van 16065 * 512 = 8225280 bytes
    Schijf-ID: 0xeaca5f2c
    Apparaat Opstart   Begin       Einde     Blokken   ID  Systeem
    /dev/sda1   *           1        8475    68075406    7  HPFS/NTFS
    /dev/sda2            8476       56711   387442688+   7  HPFS/NTFS
    /dev/sda3           57998       60801    22523130    f  W95 Uitgeb. (LBA)
    Partition 3 does not end on a cylinder boundary.
    /dev/sda5           58252       60801    20482875   83  Linux
    /dev/sda6           57998       58250     2032159+  82  Linux wisselgeheugen
    This is the output of parted:
    Model: ATA WDC WD5000AAKS-0 (scsi)
    Schijf /dev/sda: 500GB
    Sectorgrootte (logisch/fysiek): 512B/512B
    Partitietabel: msdos
    Nummer  Begin   Einde   Grootte  Type      Bestandssysteem  Vlaggen
    1      32,3kB  69,7GB  69,7GB   primary   ntfs             opstartbaar
    2      69,7GB  466GB   397GB    primary   ntfs
    3      477GB   500GB   23,1GB   extended                   lba
    6      477GB   479GB   2081MB   logical   linux-swap
    5      479GB   500GB   21,0GB   logical   ext4
    I actually got the same error on my other system too, but then I deleted all the partitions, which is not really an option on this system. What is causing this problem?
    Last edited by Revelation60 (2009-03-21 17:56:44)

    Oh, ok then, that makes sense ... I don't know the reason to align partitions to cylinders but there must be a good reason, although even if they are not aligned it shouldn't be a big problem (at least gparted allows you to create unaligned partitions).
    Personally gparted is not my first choice when dealing with partitions, it already scared me _big time_ and even if linux doesn't complain about partitions not being in the order they are on disk some programs complain about that (and gparted does make a mess out of that) and even refuse to do anything before they fix that (partition magic for example, and I've never lost any data or even got scared when using it).
    Lately I have been doing it like this, create the partitions with cfdisk which leaves everything in a way no program complains, then I format the partitions with mkfs.whatever or I use gparted just to format the partitions, I've never had problems when doing things like that.
    The last time I've used gparted to resize partitions things went well but on another occasion it did make a huge mess out of the partition layout (there were ntfs partitions involved when it went wrong, and only ext3 when all went well) leaving me with a problem similar to what you have now, luckily testdisk came to the rescue but I reckon I was just lucky that time.
    I've learned my lesson, _always_ make backups or copy things to another disk, besides being probably faster (as gparted does a ton of checks) it is a lot safer and if you have really important stuff on your hard disk you can't afford to be relying on the chance of not loosing it in the process.

  • Logical partitions invisible after deleting EISA WinRE partition on Equium

    Hi,
    I have a double boot with Vista pre-installed and XP. So, I had in total 3 primary partitions and 1 extended with some logical partitions within it. I keep Vista on reserve and use solely XP as boot partition. I wanted to try a third OS but I had reached the max of 4 primary partitions on the disk. So I made a backup of and removed the EISA WinRE partition that was preinstalled with Vista, thinking this would only affect Vista, as my only boot is XP.
    I used XP's Computer Management tool for this. But when I right click on WinRE and chose "delete", the partition became unallocated, but also ALL logical volumes on the extended partition, except for the first one.
    I tried to revert the process recovering WinRE with the Acronis image, but I the extended partition still shows only the first volume and no trace of the rest of my data. Obviously, this was a big mistake and WinRE seems to contain more than information for Vista recovery.
    How can I get back my logical partitions?
    Thanks for any help

    Hmm I doubt you could be abele to restore the WinRE partition again without a usage of the Vista CD it seems you have completely delete this partition an also the whole data from the partition.
    I agree with you and it was really a big mistake sorry but I dont see any big chanced to get it back however maybe someone has another idea.

Maybe you are looking for

  • Tried EVERYTHING, iTunes still won't run

    Hi all, I apologize for the length of this post, but i'm at the end of my rope and want to be as specific as possible, for hope that someone out there can help. I will give you my firstborn child and a massage if you can fix this. Here's the situatio

  • Not showing duplication.

    Example below. For the first 3 records I do not want to duplicate the district for the same user: I do not want to duplicate the acct # for the same name. change from DISTRICT USER ACCT# NAME 1 MIC 11 James 1 MIC 11 Maria 1 MIC 11 Jennifer 2 MIN 22 H

  • Adding xml to scrolling text window

    The problem is, I used this tutorial to make my scroll window. It seems to coding method isn't the best way to do it, as it makes it a pain in the *** to update. The guy didn't even put it in as an actionscript text, I would have to open up the text

  • Login module get client ip problem

    hi everyone,    we have a custom login module and it works well.  But now a new requirement come out that we must do some check about the client ip address.    I type my code like this: ((HttpGetterCallback) callbacks[1]).setType(HttpCallback.CLIENT_

  • Arm load error

    hi can anyone help, i just got a palm os tungsten t3 with tomtom navigator on. the thing is a armread:could not open file, what dose it mean, can anyone help. and all my maps have gone of the sd card, how can i get them back. Post relates to: Tungste