1

Topic: move luks partition

hi.
i wonder how i can move to the left (the beginning) of my hdd a LUKS partition.

if gparted does allow it (i can't check that since i can't run it. see the other post below), but if not.
with what other low level tools can i do that ?
just a copy of data but dd is not helpfull because i need to do at the same time  delete a partition creatae a new one and the move the date that was in one the deleted ones.

2

Re: move luks partition

Does it help ?
http://gparted.sourceforge.net/larry/tips/gfs.htm

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

3 (edited by zebul666 2007-03-11 22:23:11)

Re: move luks partition

yes i know that. i have use it by the past.

but the LUKS partition with a xfs filesystem in it is recognized as Unkown (black color) by gparted

and sorry but that thread should be moved in General (or elsewhere ?)

4

Re: move luks partition

You are right i move it.
Any way i have not the answer.
I will contact Plors about that point.

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

5

Re: move luks partition

as the partition is not recognized (Unknown) i can't use the resize/move option for that partition . it is greyed out.

6

Re: move luks partition

Neither Plors know what "luks" is sad
no lucke wink

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

7 (edited by zebul666 2007-03-12 18:45:38)

Re: move luks partition

why can't we simply move a partition whatever is the type of its partition ? be it recognized or not. it is just simply copying bytes from one place to one another. so why is it not simply possible in gparted and the partition must be recognised ????

LUKS stand for Linux Unified Key Setup and is a protocol to encrypt partition

go learn something there
http://luks.endorphin.org/
http://en.wikipedia.org/wiki/LUKS

it uses device-mapper

for your future develeppment, go and look at the protocol spec http://luks.endorphin.org/LUKS-on-disk-format.pdf

an example
[~]# LANG=C dd if=/dev/hda10 count=1 bs=512|xxd
1+0 records in
1+0 records out
512 bytes (512 B) copied, 5.5816e-05 s, 9.2 MB/s
0000000: 4c55 4b53 babe 0001 6165 7300 0000 0000  LUKS....aes.....
0000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000020: 0000 0000 0000 0000 6362 632d 6573 7369  ........cbc-essi
0000030: 763a 7368 6132 3536 0000 0000 0000 0000  v:sha256........
0000040: 0000 0000 0000 0000 7368 6131 0000 0000  ........sha1....
0000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000060: 0000 0000 0000 0000 0000 0408 0000 0010  ................
0000070: a951 785b 4feb 27e6 485b 9e3c 7b43 0306  .Qx[O.'.H[.<{C..
0000080: 9b82 4bfe 2aa1 db17 5713 b32d 8a60 2660  ..K.*...W..-.`&`
0000090: 52bc 7c84 e1e2 f46f 36ab 3b45 fcd6 85fb  R.|....o6.;E....
00000a0: a814 80c0 0000 000a 6162 3339 6632 6639  ........ab39f2f9
00000b0: 2d33 3561 612d 3465 6339 2d39 3334 622d  -35aa-4ec9-934b-
00000c0: 6237 3837 3932 3864 6232 6165 0000 0000  b787928db2ae....
00000d0: 00ac 71f3 0001 e52e 27ad 3238 d6cb 425e  ..q.....'.28..B^
00000e0: d702 4303 c8ac c538 a310 829c dfdf 1c0a  ..C....8........
00000f0: 1a45 212c 9414 38e0 0000 0008 0000 0fa0  .E!,..8.........
0000100: 0000 dead 0000 0000 0000 0000 0000 0000  ................
0000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000120: 0000 0000 0000 0000 0000 0088 0000 0fa0  ................
0000130: 0000 dead 0000 0000 0000 0000 0000 0000  ................
0000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000150: 0000 0000 0000 0000 0000 0108 0000 0fa0  ................
0000160: 0000 dead 0000 0000 0000 0000 0000 0000  ................
0000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000180: 0000 0000 0000 0000 0000 0188 0000 0fa0  ................
0000190: 0000 dead 0000 0000 0000 0000 0000 0000  ................
00001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001b0: 0000 0000 0000 0000 0000 0208 0000 0fa0  ................
00001c0: 0000 dead 0000 0000 0000 0000 0000 0000  ................
00001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001e0: 0000 0000 0000 0000 0000 0288 0000 0fa0  ................
00001f0: 0000 dead 0000 0000 0000 0000 0000 0000  ................

so the first bytes of a LUKS partition is marked with .... LUKS string

8

Re: move luks partition

i finally manage to move my LUKS partition and resize it as i wished.
I made a little soft in C with libparted.
the code (commented in english) is on this page (in french). look for move.c
http://home.tele2.fr/solsTiCe/luks.html

9

Re: move luks partition

@zebul666: do you still have that script?

I would be very interested in using it smile

10

Re: move luks partition

it's not a script. It's a C program and you will need to configure/customize it to your need because it is very specialized to the need I had
i.e. it could only move the last partition to the left. that's all

http://solstice.dhiver.pagesperso-orange.fr/luks
http://solstice.dhiver.pagesperso-orang … ove.tar.gz

you should be extra-carefull when using this. make backup of all your hard-drive

also it was made against an old version of libparted. It's still compiles but there may be side effect.
The code is quite simple and commented so you should understand it if you know C enough

I made my test of my program on a virtual disk. just a file partitioned and mounted as loopback
the process was a little complicated:
so create.c create a 256MB file with a primary ext3 partition and 2 extended partition, one resierfs and one with no fs
then with createdevice.sh, I make the luks partition.
and mount it as a loopback to be able to run test on it