Saturday, August 13, 2011
DISK/LVM Commands for Unix/Linux
In the olden days computer disks were small compared to the data set sizes that were needed. A solution is to make several physical disks appear virtually (or logically) as a single much larger disk. A large filesystem could then be created on that virtual disk.
Later hard disk sizes grew large enough that it made sense to do the opposite: make one physical disk appear as several virtual disks. Each virtual disk holds a filesystem independently of the others. Today such virtual disks are called disk "partitions".
Now we have come full circle. Large data warehouse applications require very large filesystems to hold the database data files. To support this sort of application the old idea of combining several disks into one has been resurrected. Novell Netware supported this feature since the 1990s. The physical disk (or selected disk partitions) are formatted to be "physical volume segments". All added physical volume segments become part of a single large virtual disk. The administrator can then create logical "volumes", that is, a filesystem. The exciting part is that if some volume is low on space, you can extend the virtual disk by adding another physical volume segment to it, and then increase the (logical) volume's size. This operation is fast and doesn't disturb the existing data or other partitions (or volumes)!
The modern Unix (and Linux) version of this idea is called "Logical Volume Management" (or "LVM"). LVM allows the administrator to
- use and allocate disk space more efficiently and flexibly
- move logical volumes between different physical devices
- have very large logical volumes span a number of physical devices
- take snapshots of whole filesystems easily, allowing on-line backup of those filesystems
- replace on-line drives without interrupting services
Linux also supports software RAID, which, like LVM, can be used to provide disk striping. The two systems are independent of each other. So you can use RAID to provide striping and use that RAID volume as a physical volume for LVM. There is no reason to use both software RAID and LVM, although it can be done. However it does make good sense to use hardware RAID and LVM together.
HP-UX:Disk &Filesystem | SOLARIS | |||
Filesystem table | /etc/filesystems | /etc/fstab | /etc/fstab | /etc/vfstab |
Free disk blocks | df -k | bdf | df -k | df -k |
Device listing | lsdev -C | /sbin/ioscan | cat /proc/devices | sysdef |
Disk information | bootinfo -s hdisk# | diskinfo /dev/rdsk/c#t#d# | cat /proc/scsi/scsi0/sda/model | format -d c#t#d# format>current format>inquiry |
Disk Label | lspv -l hdisk# | pvdisplay -v /dev/dsk/C#t#d# | fdisk -l | prtvtoc |
LVM Concepts | Partition | logical extents | logical extents | sub disk |
Volume | logical volume | logical volume | Volume | |
Plex | ||||
Volume group | volume group | volume group | disk group | |
Journal Filesystem type | jfs | vxfs | ext3 reiserfs | vxfs |
Default volume group | /dev/rootvg | /dev/vg00 | /dev/vx/dsk/rootdg | |
Display volume group | lsvg -l rootvg | vgdisplay -v vg00 | vgdisplay -v | vxprint -l -g rootdg |
Modify physical volume | chpv | pvchange | pvchange | |
Prepare physical disk | mkdev -c disk -l hdisk# | pvcreate | pvcreate | vxdiskadd |
List physical volume | lspv | pvdisplay | pvdisplay | vxprint -dl |
Remove disk from volume group | reducevg | vgreduce | vgreduce | vxdg rmdisk |
Move logical volumes to another physical volumes | migratepv | pvmove | pvmove | vxassist move |
Create volume group | mkvg | vgcreate | vgcreate | vxdg init |
Remove volume group | vgremove | vgremove | ||
Volume group availability | chvg varyonvg varyoffvg | vgchange | vgchange | |
Restore volume group | vgcfgrestore | vgcfgrestore | ||
Exports volume group | exportvg | vgexport | vgexport | vxdg deport |
Imports volume group | importvg | vgimport | vgimport | vxdg import |
Volume group listing | lsvg | vgscan | vgscan | |
Change logical volume characteristics | chlv | lvchange | lvchange | vxedit set |
List logical volume | lslv | lvdisplay | lvdisplay | vxprint -vl |
Make logical volume | mklv | lvcreate | lvcreate | vxassist make |
Extend logical volume | extendlv | lvextend | lvextend | vxassist growto |
Reduce logical volume | AIX reduce LV | lvreduce | lvreduce | vxassist shrinkto |
Remove logical volume | rmlv | lvremove | lvremove | vxedit rm |
Prepare boot volumes | bootlist -m normal | lvlnboot | lilo | vxbootsetup |
Remove boot volumes | lvrmboot | |||
Extend File system | chfs -a size=# /mt | extendfs /dev/vg00/lvol8 fsadm -F vxfs -b {LE * 1024} /mt | resize2fs resize_reiserfs | vxva mkfs -M |
Reduce/Split mirrors | rmlvcopy | lvsplit | lvsplit | |
Merge mirrors | lvmerge | lvmerge | ||
Create mirrors | mklv -c 2 | lvcreate -m 1 | vxassist mirror | |
Add mirrors | mklvcopy lv 2 | lvextend -m 1 | ||
Create striped volumes | mklv -u 3 -S 64K | lvcreate -i 3 -I 64 | lvcreate -i 3 -I 64 | vxassist make vol 100mb layout=raid5 |
System recovery tape | mksysb -i /dev/rmt0 | /opt/ignite/bin/make_recovery | ||
Backup | savevg -i rootvg | fbackup | tar cvf /dev/rst0 / | ufsdump |
Restore | restvg | frecover | tar xvf /dev/rst0 | ufsrestore |
No Response to "DISK/LVM Commands for Unix/Linux"
Leave A Reply