recover-disk-space

2024-10-05 4 min read Linux Storage Administration

Recovering Disk Space by Reducing Reserved Block Count on Linux

Introduction

In Linux systems, disk space management is crucial, especially when storage is running low. One often-overlooked aspect is the space reserved by the filesystem, known as reserved blocks. These blocks can consume a significant amount of disk space. In this post, we’ll explore what reserved blocks are, why they’re important, and how you can reduce the reserved block count to free up space.

Continue reading

mv command with progress

2018-03-19 1 min read Bash

When moving large files/directories, I would like to see the progress.

Idea for this is to use rsync with progress and remove source files. But that option does not remove the empty directories left behind so find command to delete that.

So, here is function for that:

mv-progress () 
{ 
    rsync -ah --progress --remove-source-files "$1" "$2";
    find "$1" -empty -delete
}

Scripts to create logins from bash command – for creating multiple accounts

2010-06-09 1 min read Fedora Linux

Heres the script:

cat «EOF > login.sh
for i in  `cat logins` ; do
login=`echo ”$i”|awk -F”:” '{print $2}’`;
comment=”`echo ”$i”|awk -F”:” '{print $1}’`”;
gr=”`echo ”$i”|awk -F”:” '{print $3}’`”;
echo ”login –» $login –Comment –» $comment  –Group –»$gr  –”;
echo ”useradd -c ”$comment” -d /export/home/$login -m -g $gr -s /bin/bash $login”
useradd -c ”$comment” -d /export/home/$login -m -g $gr -s /bin/bash $login
done

You would need to create file called logins to store the comment, login name and the group. The group must have already been created. Here is an example of the file:

Continue reading

Kill processes that have been running for more than a week

2010-02-04 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/kr_otvdAVxA/kill-processes-that-have-been-running-for-more-than-a-week">Kill processes that have been running for more than a week
$ find /proc -user myuser -maxdepth 1 -type d -mtime +7 -exec basename {} ; | xargs kill -9

  • <a href="http://www.commandlinefu.com/commands/view/3702/kill-processes-that-have-been-running-for-more-than-a-week">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/sharfah">View all commands by <a href="http://feeds2.feedburner.com/commands/by/sharfah">sharfah

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="commandlinefu.com" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/amit-agarwal.co.in/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/0/di" border="0" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/amit-agarwal.co.in/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/1/di" border="0" alt="" align="bottom" />

Continue reading