Avatar of kurajesh
kurajesh
 asked on

Linux Free Space

hi,

how to find out the free space in a linux system. i have a server where i know that there are free spaces available but df -kh and fdisk -l doent diaply exactly the free space info

how to find out the exact free space info
Linux

Avatar of undefined
Last Comment
kurajesh

8/22/2022 - Mon
omarfarid

df -kh will show the filesystems that are created and mounted.

fdisk should show you the partitions created on the disk but the free disk space (not partitioned) I think needs to be calculated
Abhishek_Chib

Hi,

You can use following commands :

# df -h ( in MB and GB )
# df -ig ( For inode )

Once you find the partition, use "du -sh" to find the size of folder and files

Secondly, if you are trying to that you HDD is 100 GB and showing somewhere around 96GB, do not worry, 4GB used by Linux OS that we call it "File System Area"

 
kurajesh

ASKER

i did try with df -h and the result is same as df -kh whereas i had kept additional space while buidling the server.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Abhishek_Chib

Note: Correct command for inode # df -i  
Abhishek_Chib

kurajesh, can you share you exact details, what you are trying to do ?

From you initial comments, it seem that you not able to see disk space.
kurajesh

ASKER

i meant that total hdds' space is 1.2tb outof which 100gb i have not made a separate parition. rest 1.1tb has been paritioned and properly mounted. now when i df -kh i can see all 1.1tb perfectly but the 100gb is not showing in the table

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Abhishek_Chib

its little bit tricky, us command fdisk command

# fdisk /dev/XXXX ( XXXX will be you HDD name )
# Press p ( for partition table )

You will see some values like :


Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006cd01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        9729   77943361   8e  Linux LVM

Check how may cylinders left and multiple by 512 ( treat as a example )


kurajesh

ASKER
i just checked the table and output is as follows:


[root@localhost ~]# fdisk /dev/cciss/c0d0

The number of cylinders for this disk is set to 71380.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/cciss/c0d0: 587.1 GB, 587128266752 bytes
255 heads, 63 sectors/track, 71380 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1         255     2048256   83  Linux
/dev/cciss/c0d0p2             256       25751   204796620   83  Linux
/dev/cciss/c0d0p3           25752       41049   122881185   83  Linux
/dev/cciss/c0d0p4           41050       71380   243633757+   5  Extended
/dev/cciss/c0d0p5           41050       53797   102398278+  83  Linux
/dev/cciss/c0d0p6           53798       60171    51199123+  83  Linux
/dev/cciss/c0d0p7           60172       61701    12289693+  82  Linux swap
/dev/cciss/c0d0p8           61702       62976    10241406   83  Linux

Command (m for help): q

[root@localhost ~]# fdisk /dev/cciss/c0d1

The number of cylinders for this disk is set to 72937.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/cciss/c0d1: 599.9 GB, 599932581888 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d1p1   *           1       25496   204796588+  83  Linux
/dev/cciss/c0d1p2           25497       50992   204796620   83  Linux
/dev/cciss/c0d1p3           50993       63740   102398310   83  Linux

Command (m for help): q

[root@localhost ~]#


from the above how can i find that unassigned space
ASKER CERTIFIED SOLUTION
Abhishek_Chib

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
kurajesh

ASKER
thanks abhishek,
now it is clear, how we can allocate this 9197 + 8100 (170gb) into a new single partition as they are from c0d0 and c0d1

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
upanwar

For using space from two different disks to one partition you have to use LVM for the same.

If you have need any help to create that you can ask us and also add the output of df -Th command in you require help to configure LVM.
kurajesh

ASKER
I would prefer to configure lvm and can you let me know how can I got qbout this. Also how can I configure a script to have complete file system backup.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
kurajesh

ASKER
i will certainly try this lvm and update quickly, thanks a lot
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
kurajesh

ASKER
the lvm details were useful, completed the setup, thanks a lot abhishek & upanwar