Categories
Uncategorized

Debian – How to transparently bridge Ethernet interfaces

Yesterday, I wrote a short note about VLAN interfaces. Today, I want to write a short entry on how to bridge Ethernet interfaces to keep things complete as I need to mention about creating ACCESS port to tag packets on desired interface.

Categories
Uncategorized

How to create VLAN interface

VLAN (virtual local area network) is very useful concept as you can easily separate device management from users by using appropriate network devices and configuration. I will describe here in a form of a short note how to create VLAN interface using Debian system.

Categories
Uncategorized

Debian – How to change time zone

This is rarely performed task but an easy one. To change time zone you need to reconfigure tzdata package.

Categories
Uncategorized

Ubuntu Precise – Install youtube-dl package using Quantal repo

Ubuntu Precise 12.04 currently contains in repository youtube-dl version 2012.02.27-1. As of recent YouTube changes this package version is not usable anymore but there is an updated version in Ubuntu Quantal 12.10 repository. To use it you need to perform couple of steps described below.

Categories
Uncategorized

CentOS – How to manage system services

Short note on how to manage system services using CentOS.

Categories
Uncategorized

How to modify squashfs image

You cannot modify squashfs image directly but you can uncompress it, apply changes and compress it again.

Categories
Uncategorized

Ubuntu – How to use persistent encrypted partition

Simple solution using Linux Unified Key Setup.

Categories
Uncategorized

Ubuntu – How to use encrypted tmp partition

The answer is to recreate encrypted tmp partition every boot with random key as you do not need to keep temporary data in memory.

Categories
Uncategorized

Ubuntu – How to encrypt swap partition

Create partition for swap (/dev/sdaX in this example). Prepare and enable it using mkswap and swapon commands. If you already use swap partition then omit these steps.

$ sudo mkswap /dev/sdaX
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=325d9718-8532-460d-afec-74e6aee9ae5f
$ sudo swapon /dev/sdaX

Execute ecryptfs-setup-swap script (it is part of ecryptfs-utils package):

$ sudo ecryptfs-setup-swap
WARNING:
An encrypted swap is required to help ensure that encrypted files are not leaked
to disk in an unencrypted format.
HOWEVER, THE SWAP ENCRYPTION CONFIGURATION PRODUCED BY THIS PROGRAM
WILL BREAK HIBERNATE/RESUME ON THIS SYSTEM!
NOTE: Your suspend/resume capabilities will not be affected.
Do you want to proceed with encrypting your swap? [y/N]: y
INFO: Setting up swap: [/dev/sdaX]
 * Stopping remaining crypto disks...
 * cryptswap1 (stopped)...                                                [ OK ]
 * Starting remaining crypto disks...
 * cryptswap1 (starting)..
 * cryptswap1 (started)...                                                [ OK ]
INFO: Successfully setup encrypted swap!

Changes are automatically applied to crypttab and fstab configuration files.

$ cat /etc/crypttab | grep /dev/sdaX
cryptswap1 /dev/sdaX /dev/urandom swap,cipher=aes-cbc-essiv:sha256
$ cat /etc/fstab | grep cryptswap1
/dev/mapper/cryptswap1 none swap sw 0 0
Categories
Uncategorized

How to backup DOS-type partition table/GPT and LVM metadata?

DOS partition table

We can use sfdisk to dump partition table in usable format and store it:

$ sudo sfdisk -d /dev/sda > sda_partitions

Partition table can be restored using stored backup:

$ sudo sfdisk /dev/sda < sda_partitions

Partition table can be easily cloned (from sda to sdz in this example):

$ sudo sfdisk -d /dev/sda | sfdisk /dev/sdz

GPT

To backup GUID partition table use sgdisk command (from gdisk package):

$ sudo sgdisk -b sda_gpt_backup /dev/sda

Restore it in similar way:

$ sudo sgdisk -l sda_gpt_backup /dev/sda

LVM

To backup LVM metadata for volume group vol_test to vol_test_backup file use command:

$ sudo lvm vgcfgbackup -f vol_test_backup vol_test

To restore volume group metadata use similar command:

$ sudo lvm vgcfgbackup -f vol_test_backup vol_test

To restore physical volume metadata (with specified UUID to /dev/sda1 device):

$ sudo pvcreate --restorefile vol_test_backup --uuid rRD... /dev/sda1

There is a little more work to be done in this case (beyond this short post) so jump directly to Red Hat – Logical Volume Manager Administration.