comingme has asked for the wisdom of the Perl Monks concerning the following question:
I run a little script that prints the available space for file system:
Code:========================================#!/usr/bin/perl5 sub CheckDiskSpace { use Filesys::DiskFree; my $handle = new Filesys::DiskFree; $handle->df(); $loc1 = '/dev'; $loc2 = '/var/run'; $loc3 = '/boot'; print "... $loc1, $loc2, $loc3, '/' \n"; foreach my $file ($loc1,$loc2,$loc3,'/' ) { my $bytesavailable=$handle->avail($file); print "at $file, available bits = $bytesavailable \n"; } } CheckDiskSpace();
The result is:
... /dev,/var/run,/boot,'/'
at /dev, available bits = 1028820992
at /var/run, available bits = 1028730880
at /boot, available bits =
at /, available bits =
========================================I then type command "df -a" and get:
Code:========================================Filesystem 1K-blocks Used Available Use% Mounted on proc 0 0 0 - /proc /sys 0 0 0 - /sys varrun 1004736 116 1004620 1% /var/run varlock 1004736 0 1004736 0% /var/lock udev 1004736 28 1004708 1% /dev devshm 1004736 12 1004724 1% /dev/shm devpts 0 0 0 - /dev/pts tmpfs 1004736 12 1004724 1% /dev/shm securityfs 0 0 0 - /sys/kernel/se +curity gvfs-fuse-daemon 620395268 10647256 609748012 2% /root/.gvfs /dev/sda1 497829 139305 332822 30% /media/_boot
I then run "gparted" and tt shows /dev/sda3 is mounted to '/' and '/dev/.static/dev'. It's a graphic tool and I do not know how to post pictures here.
========================================The thing I do not understand is: Why cannot perl script tell the available size of "/"? Why doesnot df command show "/" as a mount point while gparted correctly shows that? I tried to mount /dev/sda3 to '/' but it says it already exists. My system is ubuntu server. Can someone help me? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help on mount of /
by matze77 (Friar) on Jan 14, 2010 at 18:21 UTC | |
by zwon (Abbot) on Jan 14, 2010 at 19:14 UTC | |
by comingme (Initiate) on Jan 14, 2010 at 19:21 UTC |