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
LVL 1
kurajeshSenior Systems AnalystAsked:
Who is Participating?
 
Abhishek_ChibConnect With a Mentor Commented:
See the BOLD area

++++++++++++++++++++++++++++++++++++++++++++++++++++++
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

++++++++++++++++++++++++++

Diff cylinders = 72937 - 63740 = 9197 ( That is your free space )


0
 
omarfaridCommented:
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
0
 
Abhishek_ChibCommented:
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"

 
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
kurajeshSenior Systems AnalystAuthor Commented:

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

0
 
Abhishek_ChibCommented:
Note: Correct command for inode # df -i  
0
 
Abhishek_ChibCommented:
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.
0
 
kurajeshSenior Systems AnalystAuthor Commented:

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

0
 
Abhishek_ChibCommented:
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 )


0
 
kurajeshSenior Systems AnalystAuthor Commented:
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
0
 
kurajeshSenior Systems AnalystAuthor Commented:
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

0
 
upanwarCommented:
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.
0
 
kurajeshSenior Systems AnalystAuthor Commented:
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.
0
 
Abhishek_ChibConnect With a Mentor Commented:
Hi,

Follow link for LVM :

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch27_:_Expanding_Disk_Capacity

And for filesystem backup use some professional backup service or tool in your case.

Note : Data is huge

0
 
upanwarConnect With a Mentor Commented:

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

# fdisk /dev/cciss/c0d0

At the Linux fdisk command prompt,

1. press n to create a new disk partition,
2. press e to create an extended disk partition,
3. press ENTER twice to accept the default of 1st and last cylinder – to convert the rest disk space to a single disk partition,
4. press t  to change the default Linux partition type (0×83) to LVM partition type (0x8e),
5. press L to list all the currently supported partition type,
6. press 8e (as per the L listing) to change partition to 8e, i.e. Linux LVM partition type,
7. press p to display the hard disk partition setup. Please take note that the new partition is denoted as /dev/cciss/c0d0p9 in Linux,
8. press w to write the partition table and exit fdisk upon completion.


Then repeat the same task for another disk.

# fdisk /dev/cciss/c0d1

At the Linux fdisk command prompt,

1. press n to create a new disk partition,
2. press e to create an extended disk partition,
3. press ENTER twice to accept the default of 1st and last cylinder – to convert the rest disk space to a single disk partition,
4. press t  to change the default Linux partition type (0×83) to LVM partition type (0x8e),
5. press L to list all the currently supported partition type,
6. press 8e (as per the L listing) to change partition to 8e, i.e. Linux LVM partition type,
7. press p to display the hard disk partition setup. Please take note that the new partition is denoted as /dev/cciss/c0d1p4 in Linux,
8. press w to write the partition table and exit fdisk upon completion.


Then create a LVM physical volume (PV).

# pvcreate /dev/cciss/c0d0p9 /dev/cciss/c0d1p4

Now create a LVM volume group (VG) called vg01 with a physical extent size (PE size) of 16MB (Default PE size is 4 MB)

# vgcreate -s 16M vg01 /dev/cciss/c0d0p9 /dev/cciss/c0d1p4

Now execute the below given command to check size of vg01

# vgdisplay vg01

Here note down the value of Free  PE / Size and the Create a logical volume (LV) called lvol01 on volume group vg01:

# lvcreate -L <the free size which you have noted in GB>G -n lvol01 vg01

The Linux LVM setup is almost done. Now is the time to format logical volume lvol01 to create a Red Hat Linux supported file system. I am using example for ext3. You can format with the filesystem which you want to use.

mkfs -t ext3 /dev/vg01/lvol01

Create a mount point where you want to mount your newly created Filesystem:

mkdir /Path/to/mount

mount the new EXT3 file system created on logical volume lvol01 of LVM to mount point:

mount -t ext3 /dev/vg01/lvol01 /Path/to/mount


To confirm the LVM setup has been completed successfully, the df -h command should display the below given filesystem with size and mount point:

/dev/mapper/vg01-lvol01


I think its enough to configure your LVM.
0
 
kurajeshSenior Systems AnalystAuthor Commented:
i will certainly try this lvm and update quickly, thanks a lot
0
 
kurajeshSenior Systems AnalystAuthor Commented:
the lvm details were useful, completed the setup, thanks a lot abhishek & upanwar
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.