1

I have just bought 2 new drives to my raid 5 array. I have successfully added them to the array and resynced. I now have a /dev/md4 drive that is 16 TB, but the crypt-luks partition md4p1 is still 12 TB. I tried expanding it to use the whole drive with

cryptsetup resize /dev/mapper/md4p1

without success. The drive is partitioned with GPT, and everytime I start parted it complains about the backup GPT table not residing at the end of the drive. Is it safe to let it fix this, or could that corrupt the encrypted data?

prinsen
  • 162
  • 8

1 Answers1

1

As you use a partioned md device, the storage available for crypt-luks doesn't grow automatically with the md growth like it would have been if you'd put it directly on the md device. So you have to change the existing partion now manually. I'm not sure, if the partition change registers immediately though. If it were a physical disk it would have to be unused or you would have to reboot.

The GPT backup at the end should be unproblematic as the available space has grown a lot. It probably complains because the GPT backup is still at the old location which is now somewhere in the middle of the "disk". parted certainly has real drives in mind only which can't grow. This fix should be applied before resizing the partition.

  • To add, the correct sequence is: grow md device (which he did), grow partition entry, grow luks partition (`cryptsetup resize` or something), e2fsck (!), resize2fs. – Halfgaar Oct 23 '13 at 19:13
  • What is the easiest way to resize the partition? It currently starts at 1049 KB and ends at 12 TB. Im a bit worried to mess up the partition table – prinsen Oct 24 '13 at 13:46
  • I used parted to delete the old partition and create a new one. However, inside the luks partition I have a ext4 filesystem and I cant resize it beyond 16 TB... Is there any way to solve this, my new array is 20 TB? – prinsen Oct 24 '13 at 15:13
  • 16TB is the size limit of ext4 if the filesystem was created with less than 16TB size. And creating ext4 with more than 16TB is still experimental I think. – Michael Suelmann Oct 24 '13 at 19:06
  • I have run resize2fs on /dev/mapper/md4p1 and shrinked it to 11.1TB. My plan is now to create a 9 TB xfs partition beside it and then copy the data. However, /dev/mapper/md4p1 has no partition table (reported as 'loop' in parted). Is it possible to convert it to a GPT partition table without loosing data? – prinsen Oct 24 '13 at 20:07
  • /dev/mapper/md4p1 is the partition. The "disk" device is /dev/md4 – Michael Suelmann Oct 24 '13 at 20:13
  • But /dev/md4 contains a luks-partition. Inside this luks-partition I have a ext4 filesystem that I want to get rid of. I would like to use xfs instead. How do I convert this 'in place'? Only 11 TB of the 20 available is used – prinsen Oct 24 '13 at 20:28
  • Would this work: Use iosetup with an offset of 12TB on /dev/mapper/md4p1. Format the loop device with xfs. Copy the data from the ext4 partition to the xfs partition. Create a GPT partition table and create a 12 TB xfs partition. Copy everything back and detatch the loopback device? – prinsen Oct 24 '13 at 20:44
  • You will have to convert the luks-partition into an lvm volume. Seems like https://github.com/g2p/blocks can do this without losing data. Then you can add another volume for xfs. – Michael Suelmann Oct 24 '13 at 20:44
  • I successfully used blocks to convert it into an lvm volume. I verified the result with fsck. Thanks! – prinsen Oct 24 '13 at 22:08