Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
resize a LUKS loop
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
GNUtoo
Veteran
Veteran


Joined: 05 May 2005
Posts: 1919

PostPosted: Sat Mar 29, 2008 10:52 pm    Post subject: resize a LUKS loop Reply with quote

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
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Sun Mar 30, 2008 5:02 am    Post subject: Reply with quote

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
View user's profile Send private message
GNUtoo
Veteran
Veteran


Joined: 05 May 2005
Posts: 1919

PostPosted: Sun Mar 30, 2008 12:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Sun Mar 30, 2008 3:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
GNUtoo
Veteran
Veteran


Joined: 05 May 2005
Posts: 1919

PostPosted: Sun Mar 30, 2008 4:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Sun Mar 30, 2008 4:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
GNUtoo
Veteran
Veteran


Joined: 05 May 2005
Posts: 1919

PostPosted: Sun Mar 30, 2008 6:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
GNUtoo
Veteran
Veteran


Joined: 05 May 2005
Posts: 1919

PostPosted: Sat Apr 12, 2008 12:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum