ExternalUSB+LUKS+LVM: Difference between revisions
Jump to navigation
Jump to search
(New page: cryptsetup luksFormat /dev/sdb cryptsetup luksOpen /dev/sdb external pvcreate /dev/mapper/external vgcreate vg-backup /dev/mapper/external lvcreate -l 17884 vg-backup mkfs.ext4 -m 0 /dev/v...) |
No edit summary |
||
Line 1: | Line 1: | ||
cryptsetup luksFormat /dev/sdb | Format the drive for encryption, supply pass or key.. | ||
<pre># cryptsetup luksFormat /dev/sdb</pre> | |||
mount /dev/ | Open and mount the drive, it will be available at /dev/mapper/external | ||
<pre># cryptsetup luksOpen /dev/sdb external</pre> | |||
Create LVM (PV, VG, LV), format as ext4 reserving 0% for root, and mount the drive. | |||
<pre># pvcreate /dev/mapper/external | |||
# vgcreate vg-backup /dev/mapper/external | |||
# lvcreate -l 17884 vg-backup | |||
# mkfs.ext4 -m 0 /dev/vg-backup/lvol0 | |||
# mount /dev/vg-backup/lvol0 /mnt/backup</pre> | |||
cryptsetup luksClose /dev/sdb | To unmount; | ||
<pre># umount /mnt/backup | |||
# lvchange -a n /dev/vg-backup/lvol0 | |||
# vgchange -a n vg-backup | |||
# cryptsetup luksClose /dev/sdb</pre> | |||
Research: What is the best way to remove LVM's left over device files. | |||
Rsync backup; | |||
rsync -avn --delete --log-file=/root/raid5_backup.log --exclude drew/video /mnt/raid5/ /mnt/backup | This is a '''dry run''' which will delete files not on the source, log everything to ~/backup.log, exclude a video directory from all files named /mnt/raid5 to /mnt/backup. | ||
<pre># rsync -avn --delete --log-file=/root/raid5_backup.log --exclude drew/video /mnt/raid5/ /mnt/backup</pre> | |||
The real deal. | |||
<pre># rsync -av --delete --log-file=/root/raid5_backup.log --exclude /mnt/raid5/drew/video /mnt/raid5/ /mnt/backup</pre> |
Revision as of 16:14, 22 September 2009
Format the drive for encryption, supply pass or key..
# cryptsetup luksFormat /dev/sdb
Open and mount the drive, it will be available at /dev/mapper/external
# cryptsetup luksOpen /dev/sdb external
Create LVM (PV, VG, LV), format as ext4 reserving 0% for root, and mount the drive.
# pvcreate /dev/mapper/external # vgcreate vg-backup /dev/mapper/external # lvcreate -l 17884 vg-backup # mkfs.ext4 -m 0 /dev/vg-backup/lvol0 # mount /dev/vg-backup/lvol0 /mnt/backup
To unmount;
# umount /mnt/backup # lvchange -a n /dev/vg-backup/lvol0 # vgchange -a n vg-backup # cryptsetup luksClose /dev/sdb
Research: What is the best way to remove LVM's left over device files.
Rsync backup; This is a dry run which will delete files not on the source, log everything to ~/backup.log, exclude a video directory from all files named /mnt/raid5 to /mnt/backup.
# rsync -avn --delete --log-file=/root/raid5_backup.log --exclude drew/video /mnt/raid5/ /mnt/backup
The real deal.
# rsync -av --delete --log-file=/root/raid5_backup.log --exclude /mnt/raid5/drew/video /mnt/raid5/ /mnt/backup