Shrinking a filesystem have threat of data loss so be carefull about shrinking a volume. Be sure to have good back or snapshot before doing it. In Equallogic shrinking in allowed from firmware 3.2.x or greater. Shrinking of thin provisioned volume is supported from V4 or higer.
Shrinking volume to be smaller than the partition / filesystem will make data loss. Resizing to a little bigger than what it was before is okay.
The Shrink volume command is a CLI option. You need select the volume.
GrpName> vol sel volume name
GrpName(volume__volume_name)> offline
GrpName(volume__volume_name)> shrink
GrpName(volume__volume_name)> online .
Test-Production> volume select dw-open-iscsi-vol0
Test-Production(volume_dw-open-iscsi-vol0)> offline
Test-Production(volume_dw-open-iscsi-vol0)> shrink ?
– New size of the volume in MB (default) or GB.
For example: 200MB. (1GB=1024MB; 1MB=1024KB; 1KB=1024B)
Test-Production(volume_dw-open-iscsi-vol0)> shrink 200G
Test-Production(volume_dw-open-iscsi-vol0)> online
Test-Production(volume_dw-open-iscsi-vol0)> exit
Make a backup of /home and /var/spool/mail dirs:
# tar -zcvpf /root/move/home.tar.gz /home
# tar -zcvpf /root/move/mail.tar.gz /var/spool/mail
extract home.tar.gz to new server /home
# cd /
# tar -zxvf /path/to/location/home.tar.gz
Vi editor is simple to use. Given below are its switches. When you learn Linux , first thing you should learn is to how to use vi editor.
vi filename Edit filename starting at line 1
vi -r filename recover filename that was being edited when system crashed
Switch to command mode
:x quit vi, writing out modified file to file named in original invocation
:wq quit vi, writing out modified file to file named in original invocation
:q quit (or exit) vi
:q! quit vi even though latest changes have not been saved for this vi call
Deleting text (command mode)
dd Delete entire line (to buffer)
5dd Delete 5 lines (to buffer)
:5,10d Delete lines 5-10
Editing (command mode):
yy Copy line
nyy Copy n lines
:1,2t 3 Copy lines 1-2/paste after 3
:4,5m 6 Move lines 4-5/paste after 6
?string Search backward for string
/string Search forward for string
n Find next string occurrence
:%s/oldstring/newstring/cg % (entire file) s (search and replace) /old text with new/ c (confirm) g (global – all)
. Repeat last command
u Undo previous command
U Undo all changes to line
:.= returns line number of current line at bottom of screen
:= returns the total number of lines at bottom of screen
^g provides the current line number, along with the total number of lines,in the file at the bottom of the screen
Prints the shared libraries required by each program or shared library specified on the command line.
[root@dev-250 root]# ldd /bin/mv
libacl.so.1 => /lib/libacl.so.1 (0×40016000)
libc.so.6 => /lib/libc.so.6 (0x4001c000)
libattr.so.1 => /lib/libattr.so.1 (0×40141000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0×40000000)
[root@dev-250 root]#
ldconfig command in Linux
Ldconfig scans a running system and sets up the symbolic links that are used to load shared libraries properly. It also creates a cache (/etc/ld.so.cache) which speeds the loading of programs which use shared libraries.
The du command estimate file space usage and summarize disk usage of each FILE, recursively for directories.
It displays the file system block usage for each file argument and for each directory in the file hierarchy rooted in each direc tory argument. If no file is specified it will use current directory.
Type du to display usage in current directory :
$ du
Pass -h option to display output in Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte (Human-readable output)
$ du -h
Display the name and size of each png file in the /ramdisk/figs/ directory as well as a total for all of the pngs:
$ du -hc /ramdisk/figs/*.png
Another useful option is -c which produce a grand total:
$du -c You can also use : $du -s
Exclude files that match PATTERN. For example do not count *.obj or *.jpg files:
$ du -h –exclude=’*.obj’
$ du -h –exclude=’*.jpg’
A PATTERN is a shell pattern (not a regular perl or other expression). The pattern ? matches any one character, whereas * matches any string.
Pipes and filters with du
Display everything sorted by filesize:
$ du -sk .[A-z]* *| sort -n
To find top 3 directories, enter :
$ du -sk * | sort -nr | head -3