17 09 | 2012

Naming LVM volume groups

Written by Tanguy

Classified in : Homepage, Debian, Command line

From Tango Desktop Project

When you start using Linux' logical volume manager, one of the first question you have to answer is: what name will you give to your volume group? The usual answer is: vg1, vg2, etc. Although it does not bear any specific meaning, this naming convention is simple and seems functional enough.

In fact, this is a bad idea, which can have nasty consequences on the long term. Here is why: one day, your computer will eventually give out. To save your precious data, you will remove its drives and plug them into another computer. If you are using LVM with the same naming convention on that second computer, you will then get a name conflict, which will prevent you from seeing the volume group you want to recover.

The solution is to name volume groups uniquely across all your computers, and if possible other people's. An elegant way to achieve this is to use your host names as a basis. For instance, on a machine called “Piñacolada”, you would name a single volume group “pinacolada”, or two volume groups “pinacolada1” and “pinacolada2”. Or perhaps “vg-pinacolada0” or whatever, you get the idea.

19 05 | 2011

About system host names

Written by Tanguy

Classified in : Homepage, Debian, Miscellaneous, To remember

The host name

Large address book icon

On Unix systems, the host name is kept in memory by the kernel: it is set and get by the sethostname() and gethostname() functions and their command-line wrapper hostname(1). It can be used by several programs, for instance by the mail server to determine what it should use as its HELO name.

In fact, the host name has two forms: the short one and the fully qualified one. For instance, a host can have muscadet as its short name muscadet and muscadet.example.com as its fully qualified one. From these two forms, a third information can be deduced: the domain name, which is the full name without its first component.

The system host name can be set as either the short name or the fully qualified name. When the full name is used, the short one can be easily deduced, by keeping only its first component. When the short name is used, the full name must be determined by using a more complex heuristic that takes more time and can fail for several reasons.

Read more About system host names

Archives