Posts tagged cgdisk
Don't overwrite your devices via
But we've all been there, done that.
If you don't want to reinstall 'just because', an idea might be to use
testdisk depending on what you did.
Getting nice partition layout I tend to use
parted (see below), for creating partitions
cgdisk (for GPT stuff) or
cfdisk (for MBR creation only IIRC) are decent choices.
Back on topic.
Partitions were still present in my cause, so no need create them anew.
If you have to, do
parted /dev/sda p and
parted /dev/sdX u b p and use your phone to make photos, in case you have to redo something.
Create and open the cryptocontainer to hold the complete partition, wherein the LVM and your filesystems will lie.
cryptsetup --cipher=aes-xts-plain64 luksFormat /dev/sdXN --force-password cryptsetup open /dev/sdXN sdXN_crypt
Did you really type an uppercased YES when you were promted? The password you were prompted for is the one you will have to enter in the future.
In case you did something wrong:
cryptsetup close cryptsetup erase /dev/sdaX
Then start by recreating the container. Did you really type an uppercased YES when you were promted?
After the crypto device was opened, you can reference it through the device mapper. Now create the physical volume (PV), volume group (VG) and logical volumes (LV's) where your system will be installed later on:
pvcreate /dev/mapper/sdXN_crypt vgcreate `hostname` /dev/mapper/sdXN_crypt lvcreate -L 2G -n swap `hostname` lvcreate -l 100%FREE -n root `hostname`
Here is a catch: I did not have to recreate a separate
/boot partition, as I already had one.
If you don't create one first.
It has to be located outside the crypto container, else you won't be able too boot after your installation.
If something went wrong, here's how to delete things, too. Choose what you need in particular:
pvremove /dev/sdXN_crypt vgremove `hostname` lvremove /dev/`hostname`/<LVname>
filesystems and swap
Create root filesystem:
mkfs -t ext4 /dev/mapper/`hostname`-root
This is pretty much it.
From here on you can
chroot or do whatever else you want.
Maybe you only want the container for data but for installing a system on there. In that case not calling the LV 'root' and omitting the swap partition up there would have been a wise choice.
View posts from 2017-02, 2017-01, 2016-12, 2016-11, 2016-10, 2016-09, 2016-08, 2016-07, 2016-06, 2016-05, 2016-04, 2016-03, 2016-02, 2016-01, 2015-12, 2015-11, 2015-10, 2015-09, 2015-08, 2015-07, 2015-06, 2015-05, 2015-04, 2015-03, 2015-02, 2015-01, 2014-12, 2014-11, 2014-10, 2014-09, 2014-08, 2014-07, 2014-06, 2014-05, 2014-04, 2014-03, 2014-01, 2013-12, 2013-11, 2013-10