Setup Partitions: Difference between revisions

From www.deloptes.org
Jump to navigation Jump to search
No edit summary
Line 92: Line 92:
* umount and done
* umount and done


= removelogical volume =
= remove logical volume =


* umount the partition
* umount the partition
Line 103: Line 103:


  # lvremove /dev/vgcrypt/software
  # lvremove /dev/vgcrypt/software
 
 
= Sources =
= Sources =



Revision as of 23:57, 2 June 2013

FDISK

  • create partitions

RAID

  • create raid1/mirror device
# mdadm --create /dev/md7 --level=1 --raid-devices=2 /dev/sdg1 /dev/sdh1

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

remove logical volume

  • umount the partition
  • close the volume
# lvchange -an /dev/vgcrypt/software
  • remove the volume
# lvremove /dev/vgcrypt/software

Sources

[1]

[2]

[3]