Electricity Bill Calculator

Electricity Bill Calculator

Electricity Bill Cost Calculator. Electricity Usage Consumption Calculator.

Select Country:  
Typical Appliance:
Power Consumption:
Hours Of Use Per Day: Hrs/Day
One Unit Cost (1 kWh ):
 
Electricity Cost Per Day:  
Electricity Cost Per Month:  
Electricity Cost Per Year:  

Note:- 1 Unit = 1 kwh (Kilo Watt Hour)

HTML tutorial

Social Message

Social Message
Social Message Useful Health Tips

Thursday, March 24, 2016

How to Reduce File System Size on Linux

How to Reduce File System Size on Linux


Before starting, it is always good to backup the data, if something goes wrong. Easily restore from backup.

To Reduce a logical volume / file system there are 5 steps needed to be done very carefully.
While extending a volume we can extend it while the volume under mount status (online) but for reduce we must need to unmount the file system before reducing.

Fallow the below 5 steps


  • unmount the file system for reducing.
  • Check the file system after unmount.
  • Reduce the file system.
  • Reduce the Logical Volume size than Current size.
  • Recheck the file system for error.
  • Remount the file-system back to stage.


Step 1:

mohan@root# lvs

  LV      VG           Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home vg_test01 -wi-ao 431.79g
  lv_root vg_test01 -wi-ao  50.00g
  lv_swap vg_test01 -wi-ao  17.72g

mohan@root# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                      426G  199M  404G   1% /home

mohan@root# umount -v /home
/dev/mapper/vg_test01-lv_home umounted

Step 2:

mohan@root# e2fsck -ff /dev/mapper/vg_test01-lv_home
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/mapper/vg_test01-lv_home: 11/28303360 files (0.0% non-contiguous), 1827094/113190912 blocks

Step 3:

mohan@root# resize2fs /dev/mapper/vg_test01-lv_home 250G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_test01-lv_home to 65536000 (4k) blocks.
The filesystem on /dev/mapper/vg_test01-lv_home is now 65536000 blocks long.


Step 4:

mohan@root# lvreduce -L -250G /dev/mapper/vg_test01-lv_home
  WARNING: Reducing active logical volume to 181.79 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 181.79 GiB
  Logical volume lv_home successfully resized

Step 5


mohan@root# mount /home (or) mount -f /home
mohan@root# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                       50G  4.9G   42G  11% /home


Successfully reduced /home file system size.



No comments:

Post a Comment