Archive for the 'Linux Support' Category

Preventing Allocation on a Physical Volume

You can prevent allocation of physical extents on the free space of one or more physical volumes with the pvchange command. This may be necessary if there are disk errors, or if you will be removing the physical volume.

The following command disallows the allocation of physical extents on /dev/sdk1.

pvchange -x n /dev/sdk1

You can also use the -xy arguments of the pvchange command to allow allocation where it had previously been disallowed.

“pvchange -x n /dev/sdk1″ disallows the allocation of physical extents on this physical volume (possibly because of disk errors, or because it will be removed after freeing it.

SBDavid

Displaying Physical Volumes

Displaying Physical Volumes

There are three commands you can use to display properties of LVM physical volumes: pvs, pvdisplay, and pvscan.

The pvs command provides physical volume information in a configurable form, displaying one line per physical volume.

The pvs command provides a great deal of format control, and is useful for scripting.

For information on using the pvs command to customize your output,

The pvdisplay command provides a verbose multi-line output for each physical volume. It displays physical properties (size, extents, volume group, etc.) in a fixed format. The following example shows the output of the pvdisplay command for a single physical volume.

# pvdisplay
— Physical volume —
PV Name /dev/sdc1

The pvscan command scans all supported LVM block devices in the system for physical volumes.

The following command shows all physical devices found:

# pvscan
PV /dev/sdb2 VG vg0 lvm2 [964.00 MB / 0 free]
PV /dev/sdc1 VG vg0 lvm2 [964.00 MB / 428.00 MB free]
PV /dev/sdc2 lvm2 [964.84 MB]
Total: 3 [2.83 GB] / in use: 2 [1.88 GB] / in no VG: 1 [964.84 MB]

SBDavid

Scanning for Block Devices

Scanning for Block Devices

You can scan for block devices that may be used as physical volumes with the lvmdiskscan command, as shown in the following example.

# lvmdiskscan
/dev/ram0 [ 16.00 MB]
/dev/sda [ 17.15 GB]
/dev/root [ 13.69 GB]
/dev/ram [ 16.00 MB]
/dev/sda1 [ 17.14 GB] LVM physical volume
/dev/VolGroup00/LogVol01 [ 512.00 MB]
/dev/ram2 [ 16.00 MB]

lvmdiskscan scans all SCSI, (E)IDE disks, multiple devices and a bunch of other block devices in the system looking for LVM physical volumes. The size reported is the real device size. Define a filter in lvm.conf(5) to restrict the scan to avoid a CD ROM, for example.

If run as a user then.

$ lvmdiskscan
WARNING: Running as a non-root user. Functionality may be unavailable.
0 disks
0 partitions
0 LVM physical volume whole disks
0 LVM physical volumes
SBDavid

Using LVM CLI Commands

There are several general features of all LVM CLI commands.

When sizes are required in a command line argument, units can always be specified explicitly. If you do not specify a unit, then a default is assumed, usually KB or MB. LVM CLI commands do not accept fractions.

Where commands take volume group or logical volume names as arguments, the full path name is optional. A logical volume called lvol0 in a volume group called vg0 can be specified as vg0/lvol0. Where a list of volume groups is required but is left empty, a list of all volume groups will be substituted. Where a list of logical volumes is required but a volume group is given, a list of all the logical volumes in that volume group will be substituted. For example, the lvdisplay vg0 command will display all the logical volumes in volume group vg0.

All LVM commands accept a -v argument, which can be entered multiple times to increase the output verbosity. For example, the following examples shows the default output of the lvcreate command.

# lvcreate -L 50MB new_vg
Rounding up size to full physical extent 52.00 MB
Logical volume “lvol0″ created

The following command shows the output of the lvcreate command with the -v argument.

# lvcreate -v -L 50MB new_vg
Finding volume group “new_vg”
Rounding up size to full physical extent 52.00 MB
Archiving volume group “new_vg” metadata (seqno 4).
Creating logical volume lvol0
Creating volume group backup “/etc/lvm/backup/new_vg” (seqno 5).
Found volume group “new_vg”
Creating new_vg-lvol0
Loading new_vg-lvol0 table
Resuming new_vg-lvol0 (253:2)
Clearing start of logical volume “lvol0″
Creating volume group backup “/etc/lvm/backup/new_vg” (seqno 5).
Logical volume “lvol0″ created

All LVM objects are referenced internally by a UUID, which is assigned when you create the object.

SBDavid

rsnapshot filesystem backup utility

rsnapshot is a filesystem backup utility based on rsync.

Using rsnapshot, it is possible to take snapshots of your filesystems at different points in time. Using hard links, rsnapshot creates the illusion of multiple full backups, while only taking up the space of one full backup plus differences. When coupled with ssh, it is possible to take snapshots of remote filesystems as well.

rsnapshot is written in Perl, and depends on rsync. OpenSSH, GNU cp, GNU du, and the BSD logger program are also recommended, but not required.

All of these should be present on most Linux systems.

By default, the installation procedure will install all files under /usr/local. If you’ve followed these instructions so far, you will have configured rsnapshot to be installed under /usr/local, with the config file in /etc.

Under these circumstances, it will be necessary to become root to install the program. Now is the time to do so. You will, of course, need the root password to do this:

su

This will prompt you for the root password.

Now, to install rsnapshot, run the following command:

make install

This will install rsnapshot with all the settings you specified in the ./configure stage. If all goes well, you will have the following files on your system:

/usr/local/bin/rsnapshot The rsnapshot program
/usr/local/man/man1/rsnapshot.1 Man page
/etc/rsnapshot.conf.default The example config file

The latest version of the program and this document can always be found at http://www.rsnapshot.org/.

« Prev - Next »