Friday, November 16, 2012

How to reduce FileSystem LVM in Redhat 6

3 komentar

Here are steps to reduce filesystem in Linux Redhat 6 (please do full backup before your execute reducing filesystem) :

1. Umount Filesystem
[root@RedHat6]# umount /oravl99

2. Fsck that filesystem.
[root@RedHat6]# e2fsck -f /dev/vg_arch/oravl99
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vg_arch/oravl99: 11/131072 files (0.0% non-contiguous), 16821/510976 blocks

3. Resize filesystem. example wanto to reduce 1G for existing filesystem
[root@RedHat6]# resize2fs -p /dev/vg_arch/oravl99 1G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vg_arch/oravl99 to 262144 (4k) blocks.
Begin pass 3 (max = 16)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/vg_arch/oravl99 is now 262144 blocks long.

4. reduce 1Gb on the filesystem
[root@RedHat6]# lvreduce -L 1Gb /dev/vg_arch/oravl99
  WARNING: Reducing active logical volume to 1.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce oravl99? [y/n]: y
  Reducing logical volume oravl99 to 1.00 GiB
  Logical volume oravl99 successfully resized

5. Mount Filesystem
[root@RedHat6]# mount /oravl99

6. Check sizing current filesystem
[root@RedHat6]# df -h /oravl99
/dev/mapper/vg_arch-oravl99
                     1008M   34M  924M   4% /oravl99
[root@RedHat6]#

7. done
Read More..

Thursday, November 15, 2012

How to Extend LVM linux RedHat 6

0 komentar
Here are steps to extend and reduse LVM in Linux Redhat 6

1. Check sizing Volume group that filesystem want to changes

[root@RedHat6]# uname -sr Linux 2.6.32-71.el6.x86_64
[root@RedHat6]# vgs
VG #PV #LV #SN Attr VSize VFree
vg00 1 1 0 wz--n- 1020.00m 0
vgVo 1 1 0 wz--n- 3.41g 0
 vg_arch 1 1 0 wz--n- 1.95g 972.00m 
vgswap 1 1 0 wz--n- 508.00m 0
[root@RedHat6]#


[root@RedHat6]# vgdisplay vg_arch
  --- Volume group ---
  VG Name               vg_arch
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.95 GiB
  PE Size               4.00 MiB
  Total PE              499
  Alloc PE / Size       256 / 1.00 GiB
  Free  PE / Size       243 / 972.00 MiB
  VG UUID               qjyTfj-UMKx-uFDo-L1BE-xf4t-cD9O-myqJC3
[root@RedHat6]#

2. Ok, we have 972Mb free size on vg_arch and then we can add that to filesystem oravl99

[root@RedHat6]# lvs
  LV      VG      Attr   LSize    Origin Snap%  Move Log Copy%  Convert
  prod    vg00    -wi-ao 1020.00m
  lvVo    vgVo    -wi-ao    3.41g
  oravl99 vg_arch -wi-ao    1.00g
  LSWAP   vgswap  -wi-ao  508.00m
[root@RedHat6


[root@RedHat6]# lvextend -l +243 /dev/vg_arch/oravl9
Extending logical volume oravl99 to 1.95 GiB
Logical volume oravl99 successfully resized
[root@RedHat6]

===== OR we can use below command =========
[root@RedHat6]# lvextend -L +972M /dev/vg_arch/oravl99
  Extending logical volume oravl99 to 1.95 GiB
  Logical volume oravl99 successfully resized
[root@RedHat6]#
====================================

[root@RedHat6]# lvs
LV      VG      Attr   LSize    Origin Snap%  Move Log Copy%  Convert
prod    vg00    -wi-ao 1020.00m
lvVo    vgVo    -wi-ao    3.41g
oravl99 vg_arch -wi-ao    1.95g
LSWAP   vgswap  -wi-ao  508.00m
[root@RedHat6]

3. resizing filesystem oravl99

[root@RedHat6]# resize2fs /dev/vg_arch/oravl99
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_arch/oravl99 is mounted on /oravl99; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg_arch/oravl99 to 510976 (4k) blocks.
The filesystem on /dev/vg_arch/oravl99 is now 510976 blocks long.

[root@RedHat6]# df -h /oravl99
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_arch-oravl99
                      2.0G   34M  1.8G   2% /oravl99
[root@RedHat6]#

4. Done

Read More..

Monday, January 16, 2012

How To create file Tar.gz from folder in one command line

0 komentar
sometime we need creat file tar.gz from our folder/directory only with one line commandline, so here just for you guys..

$ mkdir test
$ cd test
$ touch isi
$ tar -cvf - test/ | gzip - > test.tar.gz
a test// 0K
a test//isi 0K
$ ls -ltr test*
drwxr-xr-x 2 asyu kampret 512 Jan 16 21:18 test
-rw-r--r-- 1 asyu kampret 138 Jan 16 21:24 test.tar.gz

done
Read More..
 
footer