How to resize LVM logical volumes with ext4 as filesystem


# Unmount the filesystem and check its' LV
umount /mnt/foo
e2fsck -f /dev/mapper/vg0-foo

# Shrink ext4 and then the LV to the desired size
resize2fs -p /dev/mapper/vg0-foo 40G
lvreduce -L 40G /dev/mapper/vg0-foo

# Before continuing, run e2fsck. If it bails because the partition
# is too small, don't panic! The LV can still be extended with
# lvextend until e2fsck succeeds, e.g.:
# lvextend -L +1G /dev/mapper/vg0-foo
e2fsck -f /dev/mapper/vg0-foo

# Resize the filesystem to match the LVs size, check and mount it
resize2fs -p /dev/mapper/vg0-foo
e2fsck -f /dev/mapper/vg0-foo
mount /mnt/foo

umount /mnt/bar

# Extend the LV to use all free space
lvextend -l +100%FREE /dev/mapper/vg0-bar
e2fsck -f /dev/mapper/vg0-bar

# Resize the partition to fill the LV
resize2fs -p /dev/mapper/vg0-bar
e2fsck -f /dev/mapper/vg0-bar
mount /mnt/bar

source:
source

Photo Resize from console :D

Qui raccolgo un po di script che mi sono fatto x la vita di tutti i giorni 😀

Photo resize (photo_resize)

piccolo script in ruby che serve per fare delle thumbnails di foto, passando almeno la cartella contenente le foto (strano :D)

Require:

ruby (test with: ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] ||ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux] || jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [amd64-java] )
rmagick (http://rmagick.rubyforge.org/)
optiflag (http://optiflag.rubyforge.org/)

syntax:

----------------                                      
    Description:        Folder with image to resize   
           Flag:        -s (Required, takes 1 argument) 
      Long Form:        --source                        
Alternate Flags:        -source, -S, -from              
----------------
    Description:        Folder to save the thumbnails, auto => source/thumb
           Flag:        -t (Optional, takes 1 argument)
      Long Form:        --target
Alternate Flags:        -target, -T, -to, -To
----------------
    Description:        Width max
           Flag:        -pw (Optional, takes 1 argument)
      Long Form:        --photo_width
Alternate Flags:        -width
----------------
    Description:        Height max
           Flag:        -ph (Optional, takes 1 argument)
      Long Form:        --photo_height
Alternate Flags:        -height
----------------
    Description:        Filter type: ex. jpg,JPG , default => jpg,JPG
           Flag:        -pt (Optional, takes 1 argument)
      Long Form:        --photo_type
Alternate Flags:        -type
----------------
    Description:        Help
           Flag:        -h (Optional, takes 0 arguments)
      Long Form:        --help
Alternate Flags:        -help, -?, -?
----------------
    Description:        Extended Help
           Flag:        -superhelp (Optional, takes 0 arguments)
      Long Form:        --superhelp

Tutti i miei script li trovate qui:
http://www.waydotnet.com/blog/scripts/