Recent Changes - Search:

Softwares

.

Adding-new-disk-to-LVM

Main.Adding-new-disk-to-LVM History

Hide minor edits - Show changes to output

August 19, 2012, at 02:07 PM by 101.63.165.200 -
Added lines 1-207:
(:Google1:)
(:Googletxt:)
----

!! Adding your new disk to LVM.

[@
1)
$fdisk -h
Usage:
fdisk [options] <disk> change partition table
fdisk [options] -l <disk> list partition table(s)
fdisk -s <partition> give partition size(s) in blocks

Options:
-b <size> sector size (512, 1024, 2048 or 4096)
-c[=<mode>] compatible mode: 'dos' or 'nondos' (default)
-h print this help text
-u[=<unit>] display units: 'cylinders' or 'sectors' (default)
-v print program version
-C <number> specify the number of cylinders
-H <number> specify the number of heads
-S <number> specify the number of sectors per track


2)
$mkfs - build a Linux filesystem
$ mkfs -h
Usage: mkfs [options] [-t type fs-options] device [size]

Options:
-t, --type=TYPE file system type, when undefined ext2 is used
fs-options parameters to real file system builder
device path to a device
size number of blocks on the device

3)
$ sudo pvcreate -h
[sudo] password for fedora:
pvcreate: Initialize physical volume(s) for use by LVM

pvcreate
[--norestorefile]
[--restorefile file]
[-d|--debug]
[-f[f]|--force [--force]]
[-h|-?|--help]
[--labelsector sector]
[-M|--metadatatype 1|2]
[--pvmetadatacopies #copies]
[--metadatasize MetadataSize[bBsSkKmMgGtTpPeE]]
[--dataalignment Alignment[bBsSkKmMgGtTpPeE]]
[--dataalignmentoffset AlignmentOffset[bBsSkKmMgGtTpPeE]]
[--setphysicalvolumesize PhysicalVolumeSize[bBsSkKmMgGtTpPeE]
[-t|--test]
[-u|--uuid uuid]
[-v|--verbose]
[-y|--yes]
[-Z|--zero {y|n}]
[--version]
PhysicalVolume [PhysicalVolume...]

EXAMPLES

Initialize partition #4 on the third SCSI disk and the entire fifth SCSI disk for later use by LVM:

pvcreate /dev/sdc4 /dev/sde


4)
$ sudo vgextend -h
vgextend: Add physical volumes to a volume group

vgextend
[-A|--autobackup y|n]
[--restoremissing]
[-d|--debug]
[-f|--force]
[-h|--help]
[-t|--test]
[-v|--verbose]
[--version]
[ PHYSICAL DEVICE OPTIONS ]
VolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]

Examples

"vgextend vg00 /dev/sda4 /dev/sdn1" tries to extend the existing volume group "vg00" by the new physical volumes
(see pvcreate(8) ) "/dev/sdn1" and /dev/sda4"

5)
$ sudo lvextend -h
lvextend: Add space to a logical volume

lvextend
[-A|--autobackup y|n]
[--alloc AllocationPolicy]
[-d|--debug]
[-f|--force]
[-h|--help]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
{-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] |
-L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
[-m|--mirrors Mirrors]
[--nosync]
[--use-policies]
[-n|--nofsck]
[--noudevsync]
[-r|--resizefs]
[-t|--test]
[--type VolumeType]
[-v|--verbose]
[--version]
LogicalVolume[Path] [ PhysicalVolumePath... ]

Examples

"lvextend -L +54 /dev/vg01/lvol10 /dev/sdk3" tries to extend the size of that logical volume by 54MB on physical
volume /dev/sdk3. This is only possible if /dev/sdk3 is a member of volume group vg01 and there are enough free
physical extents in it.

"lvextend /dev/vg01/lvol01 /dev/sdk3" tries to extend the size of that logical volume by the amount of free space
on physical volume /dev/sdk3. This is equivalent to specifying "-l +100%PVS" on the command line.

"lvextend -L+16M vg01/lvol01 /dev/sda:8-9 /dev/sdb:8-9"
tries to extend a logical volume "vg01/lvol01" by 16MB using physical extents /dev/sda:8-9 and /dev/sdb:8-9 for
allocation of extents.

6)
# resize2fs -h
resize2fs 1.42 (29-Nov-2011)
Usage: resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [new_size]

DESCRIPTION

The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an
unmounted file system located on device. If the filesystem is mounted, it can be used to expand the size of the
mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel sup‐
ports on-line resize for filesystems mounted using ext3 and ext4.).

The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a filesystem, you must
make sure you can expand the size of the underlying partition first. This can be done using fdisk(8) by deleting
the partition and recreating it with a larger size or using lvextend(8), if you're using the logical volume man‐
ager lvm(8). When recreating the partition, make sure you create it with the same starting disk cylinder as
before! Otherwise, the resize operation will certainly not work, and you may lose your entire filesystem. After
running fdisk(8), run resize2fs to resize the ext2 filesystem to use all of the space in the newly enlarged parti‐
tion.

If you wish to shrink an ext2 partition, first use resize2fs to shrink the size of filesystem. Then you may use
fdisk(8) to shrink the size of the partition. When shrinking the size of the partition, make sure you do not make
it smaller than the new size of the ext2 filesystem!


7)
# mount -h

Usage:
mount [-lhV]
mount -a [options]
mount [options] <source> | <directory>
mount [options] <source> <directory>
mount <operation> <mountpoint> [<target>]

Options:
-a, --all mount all filesystems mentioned in fstab
-c, --no-canonicalize don't canonicalize paths
-f, --fake dry run; skip the mount(2) syscall
-F, --fork fork off for each device (use with -a)
-T, --fstab <path> alternative file to /etc/fstab
-h, --help display this help text and exit
-i, --internal-only don't call the mount.<type> helpers
-l, --show-labels lists all mounts with LABELs
-n, --no-mtab don't write to /etc/mtab
-o, --options <list> comma-separated list of mount options
-O, --test-opts <list> limit the set of filesystems (use with -a)
-p, --pass-fd <num> read the passphrase from file descriptor
-r, --read-only mount the filesystem read-only (same as -o ro)
-t, --types <list> limit the set of filesystem types
-v, --verbose say what is being done
-V, --version display version information and exit
-w, --read-write mount the filesystem read-write (default)

-h, --help display this help and exit
-V, --version output version information and exit

Source:
-L, --label <label> synonym for LABEL=<label>
-U, --uuid <uuid> synonym for UUID=<uuid>
LABEL=<label> specifies device by filesystem label
UUID=<uuid> specifies device by filesystem UUID
<device> specifies device by path
<directory> mountpoint for bind mounts (see --bind/rbind)
<file> regular file for loopdev setup

Operations:
-B, --bind mount a subtree somewhere else (same as -o bind)
-M, --move move a subtree to some other place
-R, --rbind mount a subtree and all submounts somewhere else
--make-shared mark a subtree as shared
--make-slave mark a subtree as slave
--make-private mark a subtree as private
--make-unbindable mark a subtree as unbindable
--make-rshared recursively mark a whole subtree as shared
--make-rslave recursively mark a whole subtree as slave
--make-rprivate recursively mark a whole subtree as private
--make-runbindable recursively mark a whole subtree as unbindable
@]
Edit - History - Print - Recent Changes - Search
Page last modified on August 19, 2012, at 02:07 PM