Increase an ext2/3 partition without lossing data.

Resize ext3 partition using resize2fs which support ext3.

root@deb:/disk# ls -la
total 664228
drwxr-xr-x 3 root root 4096 Dec 19 18:29 .
drwxr-xr-x 22 root root 4096 Dec 19 17:19 ..
-rwxrwxrwx 1 nobody nogroup 679477248 Nov 26 11:31 debian-6.0.3-i386-CD-1.iso
drwx------ 2 root root 16384 Dec 19 17:18 lost+found
root@deb:/disk#

There is an ISO of Debian system. I don’t want loose it ­čÖé
Continue reading “Increase an ext2/3 partition without lossing data.”

Find file by access, change or modify time.

How to find files that were last modified 10 days ago, use:
root# find / -iname "*" -mtime -10 -print

How to find files that were last modified 10 days ago and for each of them do stat:
root# find / -iname "*" -mtime -10 -exec stat {} ;

How to find files that were last modified 24 hours ago and move them to some directory:
root# find / -name "*.png" -mmin -1440 -exec mv {} some_directory ;

How to find all files in your home directory modified or created today. By default, find counts days from midnight, so an age of zero means today.
user~> find ~ -type f -mtime 0

Find all file belongs to group “ftpusers” in /home directory, enter:
root# find /home -group ftpusers

Find all file belongs to user root in / directory
root# find / -user root

Find files and directories that are not owned by user, use:
find ~ ! -user ${USER}

Find anything in the current user’s directory that is not owned by that user and fix the permissions:
find ~ ! -user $USER -exec sudo chown ${USER}:"{}" ;

Find file and redirect errors to /dev/null
find / -name "apache2" -print 2>/dev/null


Other options:
access (read the file’s contents) – atime
change the status (modify the file or its attributes) – ctime
modify (change the file’s contents) – mtime

LVM – create, resize, remove, scan, reduce, etc.

LVM enables flexible distribution of hard disk space over several file systems. It was developed because the need to change the segmentation of hard disk space might arise only after the initial partitioning has already been done during installation. Because it is difficult to modify partitions on a running system, LVM provides a virtual pool (volume group or VG) of memory space from which logical volumes (LVs) can be created as needed. The operating system accesses these LVs instead of the physical partitions.
Continue reading “LVM – create, resize, remove, scan, reduce, etc.”