soft link Archives - CloudMinister

How to use soft link to resolve disk space issue

Hello,

One of my client is facing disk space issue on his Cheap Linux VPS Server but disk space is still available there in another partition .
He asked me for help.
I checked disk space on his server and I got below results:
root@server [~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server-lv_root 50G 45G 2.5G 95% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 77M 376M 17% /boot
/dev/mapper/vg_server-lv_home 860G 2.7G 814G 1% /home

In this tutorial I am going to use /var folder disk space in /homefolder with the help of soft link concept
As we can see that space is available more then 800GB in /home partition but we are facing issues in / partition due to log folder is making disk space full in / partition.

Client asked me why his Reliable Managed Linux VPS Server is crashed again and again due to space issue his backup is also failing due to this.

I explained his that there is only 50 GB space is assign to / directory and its already full.
There are 2 ways to resolve this issue.

One that he reassign space from /home to /.

but its create some issue server down, data lose and he is already don’t have backup from more then 1 week.

So we decided to use other solution
We used soft link as a solution we moved his /var/log folder to /home/var/ directory and then created soft link form /var/log to /home/var/log to resolve his issue.

here is standard command to create soft link:
ln -s path-to-actual-folder name-of-link

to confirm, do:
ls -ld name-of-link

We ran following command on server to create soft link:
ln -s /home/var/log/ log

then we verified it with command:
root@server [/var]# ls -ld log
lrwxrwxrwx 1 root root 14 Jun 16 03:03 log -> /home/var/log/

we have restarted all services on his server and also check his website everything is working fine.

What do mean by Inodes (index node) ? 

It is a record stored in the inode table, containing the information about the files and directories.
An inode is denoted by the phrase “file serial number”. It is just like the actual address of the file. It is a unique identifier.
There are 3 distinct areas in Linux on which our hard drives depend.

 

a) Super block b) Inode table c) Data block
  • It contains the type of file system
  • All the information about the file in linux
  • All the real data is stored in the data  block.
  • Size of the file
  • Like creation and modification date
  • When you delete something from the hard drive it doesn’t get deleted permanently, it just unlinked from the inode table unless it get overwritten by newer data
  • They store redundantly on the disk (duplicate)

(backups)

  • The reference of the data is stored in the inode table
  • In most cases the data can be recovered even after you’ve deleted it.

Soft link & Hard link

Soft link are similar to MS windows shortcut.

  • One file can have many shortcuts pointing to it.
  • Directory soft link
    ** dir007 is a dir. and dir is soft link.

File soft link

** file1= file and f1 is a shortcut link           ** 1 denotes the only one link

If we remove the original file the soft link will automatically be deleted.

Hard Link are just different names for the same file

  • One file can have many different names or hard links.

  • The files have the same inode no.

  • We cannot create hard links for the directories.

If we remove the file the hard link will not be removed.

Conclusion: Finally we will learn what is inodes, three distinct areas on which hard drive depends and what is soft & hard link.

Get started with CloudMinister Today