Re: reduce crypt partition

2011-11-27 Thread Arno Schuring
scar (s...@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  32486438821072+  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


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/2027125916.7da06...@neminis.intra.loos.site



Re: reduce crypt partition

2011-11-27 Thread scar
Arno Schuring @ 11/27/2011 04:59 AM:
 Advice: use fdisk -u. 
 [..]
 Total sectors = 5119*8192 = 41934848

thank you!!  i added an extra 5120 sectors just to be safe and used
+41939968 in fdisk.  all seems to be working well and i now have ~18G
free space.  i'm surprised and pleased it's so simple to chop up the
partitions like that :)




-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/jau5fc$o3d$1...@dough.gmane.org



reduce crypt partition

2011-11-25 Thread scar
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.

i've been following this[1] resize guide and i am at step 5, having
already resized my logical LVM root and physical LVM volumes
successfully.  /boot is about 230M and the rest (~39G) is allocated for
crypt.  inside crypt i now have a 20G physical LVM volume with 512M swap
and 10G root logical volumes, and ~10G free space.  now i just want to
reduce crypt so it is also about 20G, leaving the rest of the ~19G as
free space on the drive.

the final step it seems, before praying, is to delete /dev/hda2 with
fdisk and recreate it with the smaller size.  i'm wondering what the
correct size should be; i'm afraid i might make it too small and then
corrupt everything somehow.  i don't have the same layout as in the
guide since ubuntu does it a little differently with extended
partitions, so a little assistance going through fdisk would be appreciated.

below is some info from fdisk and LVM, let me know if you need more
info.  thanks so much


1.
https://help.ubuntu.com/community/ResizeEncryptedPartitions#Detailed_resizing_.2BAH4_Reducing_an_encrypted_partition

$ sudo fdisk -l

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  32486438821072+  83  Linux

Disk /dev/dm-0: 39.7 GB, 39751725568 bytes
255 heads, 63 sectors/track, 4832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 10.8 GB, 10850664448 bytes
255 heads, 63 sectors/track, 1319 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x

Disk /dev/dm-2 doesn't contain a valid partition table
$ 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
  Free PE   2404
  Allocated PE  2715
  PV UUID   HMRsf8-1ePs-J33c-4tQu-7MtA-V6dv-O0U10R
$ sudo lvdisplay
  --- Logical volume ---
  LV Name/dev/graveyard/root
  VG Namegraveyard
  LV UUIDC7bLop-WiHU-dwRy-3jBR-k1QP-rQEH-X9Zchr
  LV Write Accessread/write
  LV Status  available
  # open 1
  LV Size10.11 GB
  Current LE 2587
  Segments   1
  Allocation inherit
  Read ahead sectors auto
  - currently set to 256
  Block device   254:1

  --- Logical volume ---
  LV Name/dev/graveyard/swap_1
  VG Namegraveyard
  LV UUIDyyUTnD-JVGR-BzVb-krSR-Mswq-aYoE-9YYfJt
  LV Write Accessread/write
  LV Status  available
  # open 2
  LV Size512.00 MB
  Current LE 128
  Segments   1
  Allocation inherit
  Read ahead sectors auto
  - currently set to 256
  Block device   254:2


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/jaovee$lkc$1...@dough.gmane.org