Setup Partitions: Difference between revisions
Jump to navigation
Jump to search
(Created page with " = CRYPTSETUP = '''WARNING!''' The following command will remove all data on the partition that you are encrypting. You WILL lose all your information! So make sure you backu...") |
No edit summary |
||
Line 51: | Line 51: | ||
# lvcreate -L150G -ndata G750lvm | # lvcreate -L150G -ndata G750lvm | ||
# lvcreate -L2G -nswap1 G750lvm | |||
# lvcreate -L2G -nswap2 G750lvm | |||
= Format the volumes = | = Format the volumes = | ||
Line 61: | Line 65: | ||
# mkfs.ext3 /dev/mapper/G750lvm-data | # mkfs.ext3 /dev/mapper/G750lvm-data | ||
# mkswap /dev/mapper/G750lvm-swap1 | |||
# mkswap /dev/mapper/G750lvm-swap2 | |||
= copy data = | = copy data = |
Revision as of 15:24, 1 June 2013
CRYPTSETUP
WARNING! The following command will remove all data on the partition that you are encrypting. You WILL lose all your information! So make sure you backup your data to an external source such as NAS or hard disk before typing any one of the following command.
In this example, I'm going to encrpt /dev/sdb7. Type the following command:
# cryptsetup -y -v luksFormat /dev/sdb7
- Open the crypted device
# cryptsetup luksOpen /dev/sdb7 backup
- Check the dm device
# ls -l /dev/mapper/backup
or use following command
# cryptsetup -v status backup
You can dump LUKS headers using the following command:
# cryptsetup luksDump /dev/sdb7
- Close a dm device after unmounting it
# cryptsetup luksClose backup
LVM setup
- Create physical volumes
# pvcreate /dev/mapper/backup
- Create a volume group
# vgcreate G750lvm /dev/mapper/backup
- After rebooting the system or running vgchange -an, you will not be able to access your VGs and LVs. To reactivate the volume group, run:
# vgchange -a y G750lvm
- Creating a logical volume
# lvcreate -L50G -nroot G750lvm
# lvcreate -L150G -nhome G750lvm
# lvcreate -L200G -ncustom G750lvm
# lvcreate -L150G -ndata G750lvm
# lvcreate -L2G -nswap1 G750lvm
# lvcreate -L2G -nswap2 G750lvm
Format the volumes
# mkfs.ext3 /dev/mapper/G750lvm-root
# mkfs.ext3 /dev/mapper/G750lvm-home
# mkfs.ext3 /dev/mapper/G750lvm-custom
# mkfs.ext3 /dev/mapper/G750lvm-data
# mkswap /dev/mapper/G750lvm-swap1
# mkswap /dev/mapper/G750lvm-swap2
copy data
cd /mnt test -d target || mkdir target test -d source || mkdir source
# mount ...(source) /mnt/source # mount /dev/mapper/G750lvm-root /mnt/target
# tar cf - . | (cd /mnt/target/; tar xvf -)
- umount and done