Dale wrote:
> Howdy,
>
> I thought I had done this before but it appears I have not.  I want to
> replace a 8TB drive with a 10TB drive and then remove the 8TB drive when
> done but these drives are encrypted with cryptsetup on top of LVM.  I
> looked through my how tos and can't find one for encrypted drives.  I
> did find them for regular LVM and have done that in the past.  While I
> have fresh backups, I don't want to test them if not needed.  Does this
> work just like with LVM or does the encryption change how this is done
> or even if it can be done?
>
> I googled and can't really find a good how to.  Does anyone have a link
> to a 'how to' to do this with encrypted stuff, have notes with the
> sequence of commands that I can go by or is this not doable when it is
> encrypted? 
>
> Thanks.
>
> Dale
>
> :-)  :-) 
>


Since my previous post, I've continued to look for a way to do this on
google, youtube and any place else I can think of.  So far, I have yet
to find a way.  Given no one has replied with info, I'm assuming that no
one here knows or can find a way either.  Since this involves LVM which
I know has this ability, it appears that the encryption part complicates
matters but it should be doable, I have two drives in the current setup
so I at least added a drive once before.  So, I updated my backups,
stopped any changes to the affected LVM and set out to test my theory. 
This is a list of commands in sequence that are from my notes, you may
recall my memory isn't great.  lol 

To replace drive on encrypted LVM. 
pvcreate /dev/sd<*new* drive or partition>
vgextend <group name> /dev/sd<*new* pvdevice above>
pvmove /dev/sd<drive being *removed*>  This takes a while. ;-)

vgreduce crypt /dev/sd<drive being *removed*>
pvremove /dev/sd<drive being *removed*>

To add extra/remaining space on replacement drive if any
vgdisplay <name of vg> and get unused space or PE available if using
--extents option or use 100% option
lvresize -l +100%FREE /dev/<pv name>/vg name> EXAMPLE
lvresize -l +100%FREE /dev/crypt/crypt

If LUKS, resize LUKS with
cryptsetup resize <name of encrypted>
or close and reopen.

resize2fs -p /dev/mapper/<name of lv which should be same as mount
point>  EXAMPLE
resize2fs -p /dev/mapper/crypt

Once this was done, I have a previous 8TB and a larger 10TB drive which
gives me 17TBs of space now.  I plan to buy a 12 or 14TB drive to
replace existing 8TB.  I should be done for a while. 

Now to replace my /home drive which is also close to full.  It's not
encrypted tho. The biggest difference in this and plain LVM, resizing
with cryptsetup or close and reopen.  Keep in mind, while I did all
this, LUKS, cryptsetup, whatever was open.  I'm not sure about this
being done while closed.  I did find one mention that it had to be open
at certain points. 

By the way, if someone wants to take this and make a how to out of it
somewhere, I think it would be great.  This is doable.  I even rebooted
and even tho the drives changed SATA ports, it worked fine.  So, I guess
I did it right, even if no one thought it could be done.  lol 

I really hope this helps someone else.  My brain hurts a little.  :/

Dale

:-)  :-) 

Reply via email to