lvcreate fails with the error “Aborting. Failed to activate new LV to wipe the start of it.”. Why ??

In case anyone out there gets an error message like “Aborting. Failed to activate new LV to wipe the start of it.” while doing an ‘lvcreate’, check (/etc/lvm/lvm.conf) once more.

Most probably, a ‘volume_list’ would have been defined in there, which in turns want you to specify the ‘volume_list’ tag specified along with the lvcreate command.

Excerpt from /etc/lvm/lvm.conf:

# If volume_list is defined, each LV is only activated if there is a
# match against the list.
#   vgname and vgname/lvname are matched exactly.
#   @tag matches any tag set in the LV or VG.
#   @* matches if any tag defined on the host is also set in the LV or VG
#
# volume_list = [ vg1, vg2/lvol1, @tag1, @* ]
volume_list = [ VG01, @foo.com ]

In this case, you will have to use the ‘lvcreate’ command as follows, which will create the logical volume properly.

# lvcreate –addtag @foo.com    … following-options

How to map PCI devices in Linux ?

From the output of the command ‘lspci -n’ (The number after the colon, here ‘1679’ from the below snip)

0a:04.0 0200: 14e4:1679 (rev a3)
Subsystem: 103c:703c
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium
Latency: 64 (16000ns min), Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 138
Region 0: Memory at fdef0000 (64-bit, non-prefetchable) [size=64K]
Region 2: Memory at fdee0000 (64-bit, non-prefetchable) [size=64K]

IMPORTANT:
——————-

In the above line “14e4:1679”, ’14e4′ is the UID of the manufacturer and ‘1679’ is the card model or hardware ID.

The actual way to proceed is to open the pci.ids file (‘/usr/share/hwdata/pci.ids’ and ‘/lib/modules/`uname -r`/modules.pcimap’) and check for the manufacturer UID, like ’14e4′ which is the ‘Broadcom Corporation’. The file /lib/modules/`uname -r`/modules.pcimap would be more reliable since it is from the modules of the loaded kernel.

Under that, check the card model, like ‘1679’ which is ‘NetXtreme BCM5715S Gigabit Ethernet’.

Under that you can also have subdivisions, so in order to pin-point a particular card you will have to use the ‘Subsystem’ value from ‘lspci’.

In this example, ‘Subsystem’ is 103c:703c, which turns out to be ‘NC326i PCIe Dual Port Gigabit Server Adapter’

Creating a SWAP space in Linux

Adding Swap Space:

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 64 MB to 128 MB, but there is only 128 MB of swap space. It might be advantageous to increase the amount of swap space to 256 MB if you perform memory-intense operations or run applications that require a large amount of memory.

You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.

To add a swap partition (assuming /dev/hdb2 is the swap partition you want to add):

1)  The hard drive can not be in use (partitions can not be mounted, and swap space can not be enabled). The easiest way to achieve this it to boot your system in rescue mode. Refer to Chapter 8 for instructions on booting into rescue mode. When prompted to mount the filesystem, select Skip. Alternately, if the drive does not contain any partitions in use, you can unmount them and turn off all the swap space on the hard drive with the swapoff command.

2)  Create the swap partition using parted or fdisk. Using parted is easier than fdisk; thus, only parted will be explained. To create a swap partition with ‘parted:’. At a shell prompt as root, type the command parted /dev/hdb, where /dev/hdb is the device name for the hard drive with free space. At the (parted) prompt, type print to view the existing partitions and the amount of free space. The start and end values are in megabytes. Determine how much free space is on the hard drive and how much you want to allocate for a new swap partition. At the (parted) prompt, type mkpartfs part-type linux-swap start end, where part-type is one of primary, extended, or logical, start is the starting point of the partition, and end is the end point of the partition.

            Warning     Warning
_________________________

Changes take place immediately; be careful when you type.

Exit parted by typing quit.

3) Now that you have the swap partition, use the command mkswap to setup the swap partition. At a shell prompt as root, type the following:

# mkswap /dev/hdb2

4) To enable the swap partition immediately, type the following command:

# swapon /dev/hdb2

5) To enable it at boot time, edit /etc/fstab to include:

/dev/hdb2               swap                    swap    defaults        0 0

The next time the system boots, it will enable the new swap partition.

6) After adding the new swap partition and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.

To add a swap file:
————————–
1.  Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.

2.  At a shell prompt as root, type the following command with count being equal to the desired block size:

# dd if=/dev/zero of=/swapfile bs=1024 count=65536

3. Setup the swap file with the command:

# mkswap /swapfile

4. To enable the swap file immediately but not automatically at boot time:

# swapon /swapfile

5. To enable it at boot time, edit /etc/fstab to include:

/swapfile               swap                    swap    defaults        0 0

The next time the system boots, it will enable the new swap file.

6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.

Zombie processes

Why can’t I kill a process with the signal 9?

A process can be sleeping in kernel code. Usually that’s because of faulty hardware or a badly written driver- or maybe a little of both. A device that isn’t set to the interrupt the driver thinks it is can cause this, for example- the driver is waiting for something its never going to get. The process doesn’t ignore your signal- it just never gets it.

A zombie process doesn’t react to signals because it’s not really a process at all- it’s just what’s left over after it died. What’s supposed to happen is that its parent process was to issue a “wait()” to collect the information about its exit. If the parent doesn’t (programming error or just bad programming), you get a zombie. The zombie will go away if its parent dies- it will be “adopted” by init which will do the wait()- so if you see one hanging about, check its parent; if it is init, it will be gone soon, if not the only recourse is to kill the parent..which you may or may not want to do.

Finally, a process that is being traced (by a debugger, for example) won’t react to the KILL either then you do a ps, processes that have a status of Z are called “zombies”. When people see a zombie process, the first thing they try to do is to kill the zombie, using kill or (horrors!) kill -9. This won’t work, however: you can’t kill a zombie, it’s already dead.

When a process has already terminated (“died”) by receiving a signal to do so, it can stick around for a bit to finish up a few last tasks. These include closing open files and shutting down any allocated resources (memory, swap space, that sort of thing). These “housekeeping” tasks are supposed to happen very quickly. Once they’re completed, the final thing that a process has to do before dying is to report its exit status to its parent. This is generally where things go wrong.

Each process is assigned a unique Process ID (PID). Each process also has an associated parent process ID (PPID), which identifies the process that spawned it (or PPID of 1, meaning that the process has been inherited bythe init process, if the parent has already terminated). While the parent is still running, it can remember the PID’s of all the children it has spawned. These PID’s can not be re-used by other (new) processes until the parent knows that the child process is done.

When a child terminates and has completed its housekeeping tasks, it sends a one-byte status code to its parent. If this status code never gets sent, the PID is kept alive (in “zombie” status) in order to reserve its PID … the parent is waiting for the status code, and until it gets it, it doesn’t want any new processes to try and reuse that PID number for themselves.

To get rid of a zombie, you can try killing its parent, which will temporarily orphan the zombie. The init process will inherent the zombie, and this might allow the process to finish terminating since the init process is always in a wait() state (ready to receive exit status reports of children).

Generally, though, zombies clean themselves up. Whatever the process was waiting for eventually occurs and the process can report its exit status to its parent and all is well.

If a zombie is already owned by init, though, and it’s still sticking around (like zombies are wont to do), then the process is almost certainly stuck in a device driver close routine, and will likely remain that way forever. You can reboot to clear out the zombies, but fixing the device driver is the only permanent solution. Killing the parent (init in this case) is highly unrecommended, since init is an extremely important process to keeping your system running..