View previous topic :: View next topic |
Author |
Message |
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sat Mar 29, 2008 10:52 pm Post subject: resize a LUKS loop |
|
|
hello, how do i resize a luks loop...so far i've done that:
Quote: |
==Presentation==
*you may plan to use luks but you want to be shure you can expand the volume...
*your luks loop volume is full...so you need to expand it
==How to do it==
*backup your important data that is inside the loop
*umount the filesystem of your volume, close its crypto container and remove the loop:
umount /mnt/someplace
cryptsetup luksClose yourvolume
losetup -d /dev/loop0
*expand the loop file:
dd if=/dev/zero of=tobeappended bs=1M count=1 seek=1024
cat tobeappended >> loopfile
*expand the crypto volume:
cryptsetup luksOpen /dev/loop0 yourvolume
cryptsetup resize yourvolume
*expand the filesystem(won't work with gparted)
e2fsck -f /dev/mapper/swapfs
|
but it didn't worked...
mabe that's because the loop device need to be expanded with losetup -R but it doesn't work:
Code: | # losetup -R /dev/loop0
/dev/loop0: Invalid argument
|
and my loop file is on /dev/loop0 |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Sun Mar 30, 2008 5:02 am Post subject: |
|
|
The losetup man page doesn't list a "-R" option...
Why is it needed anyway?
It should default to the full size of the file. _________________ "You have to invite me in" |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sun Mar 30, 2008 12:12 pm Post subject: |
|
|
Quote: | -R Resize existing, already set up loop device, to new changed
underlying device size. This option is for changing mounted live
file system size on LVM volume. This functionality may not be
supported on some older kernels and/or loop drivers. |
|
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Sun Mar 30, 2008 3:47 pm Post subject: |
|
|
GNUtoo wrote: | Quote: | -R Resize existing, already set up loop device, to new changed
underlying device size. This option is for changing mounted live
file system size on LVM volume. This functionality may not be
supported on some older kernels and/or loop drivers. |
| Fair enough, but you should get the exact same functionality by detaching the loop device with `losetup -d /dev/loop0`, run the dd and cat commands to increase the size of the underlying file, and then simply recreate it with `losetup /dev/loop0 loopfile`.
Unless I'm missing something... _________________ "You have to invite me in" |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sun Mar 30, 2008 4:01 pm Post subject: |
|
|
i did this...the file is now bigger,
i also resized the luks volume and the filesystem...but at the end the filesystem is the same size as before |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Sun Mar 30, 2008 4:17 pm Post subject: |
|
|
What does `dmsetup table` tell you the size of the /dev/mapper device is?
It should be the third field (including the name of the mapping), and you'll probably need to divide by 2048 to get the size in megabytes.
Is this the size it should be after resizing? _________________ "You have to invite me in" |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sun Mar 30, 2008 6:07 pm Post subject: |
|
|
according to the manual:
Quote: | TABLE FORMAT
Each line of the table specifies a single target and is of the form:
logical_start_sector num_sectors target_type target_args
|
so it's in sectors...how do i convert it in MB? |
|
Back to top |
|
|
GNUtoo Veteran
Joined: 05 May 2005 Posts: 1919
|
Posted: Sat Apr 12, 2008 12:19 pm Post subject: |
|
|
i retyped the commands and it workd...
so it's possibile...great(very usefull on a raid5/6 with evms because if i add disk i would like to grow the partition)
dividing to 2048 worked...after that i had to:
multiply by 4k and divide by 1024 the size of the filesystem |
|
Back to top |
|
|
|