[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reduce crypt partition



scar (scar@drigon.com on 2011-11-25 13:56 -0700):
> i need a little help reducing my crypt partition.  when i first
> installed debian, i used a rather standard /boot on /dev/hda1 and
> crypt on /dev/hda2, using LVM for the rest of the partitions.
[..]
> 
> $ sudo fdisk -l
Advice: use fdisk -u. It will allow you to specify partition offsets in
sectors, instead of hoping that your current fdisk aligns partitions at
the exact location that the previous partitioner did.

> 
> Disk /dev/hda: 40.0 GB, 40007761920 bytes
> 255 heads, 63 sectors/track, 4864 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Disk identifier: 0x3f423f42
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/hda1   *           1          31      248976   83  Linux
> /dev/hda2              32        4864    38821072+  83  Linux
[..]
> $ sudo pvdisplay
>   --- Physical volume ---
>   PV Name               /dev/dm-0
>   VG Name               graveyard
>   PV Size               20.00 GB / not usable 3.81 MB
>   Allocatable           NO
>   PE Size (KByte)       4096
>   Total PE              5119

sectors/PE = 4096*1024 / 512 = 8192
Total sectors = 5119*8192 = 41934848

I don't know if you need additional space for dmcrypt headers, so I
would advise to use more sectors than this minimum.

As a general rule, I always use resize2fs -M to make sure I don't get
caught in conversion errors (1000 vs 1024 etc). Also, after changing
the partitions you should resize the PV to the real size of the
partition (i.e. without size argument). It's your best way to ensure
everything has gone right.


Best of luck,
Arno


Reply to: