| Author |
Hard Drive Free Space
|
|
| Meat Loaf 2005-09-23, 5:47 pm |
| This is probably an easy question, but I can't figure out how to tell my
hard drive free space (or partition free space).
First off I couldn't remember the partitions or the sizes used from when I
did the install. I used fdisk /dev/hda and fdisk /dev/hdb to print out the
partitions. Next I typed mount to see what mount points were assigned to
each partition. On the fdisk is the blocks equivalent to bytes? So
10,000,000 blocks would be 10MB? I'm more use to VMS where block equals
512 bytes. Then the final step, I guess, is how do I determine how much
space is used. If I have that then I can subtract that from the partition
size. The reason I'm trying to do this is I have a cron job that backs up
projects files in the /usr mount point tree to a directory in the /home
mount point tree. I need to calculate the size of the backup tar files per
day with the free space left to schedule a clean up before I run out of
disk space. The mount points were something like:
hda1 /boot
hda2 /
hda3 /usr
hdb1 {swap}
hdb2 /var
hdb3 /home
hdb4 /opt
Thanks
| |
| Captain Dondo 2005-09-23, 5:47 pm |
| Meat Loaf wrote:
> This is probably an easy question, but I can't figure out how to tell my
> hard drive free space (or partition free space).
man du
man df
| |
| Darshaka Pathirana 2005-09-24, 7:46 am |
| On 2005-09-23@21:48:10, Meat Loaf <don.dayton@comcast.net> wrote:
> This is probably an easy question, but I can't figure out how to tell my
> hard drive free space (or partition free space).
>
> First off I couldn't remember the partitions or the sizes used from when I
> did the install. I used fdisk /dev/hda and fdisk /dev/hdb to print out the
> partitions. Next I typed mount to see what mount points were assigned to
> each partition. On the fdisk is the blocks equivalent to bytes? So
> 10,000,000 blocks would be 10MB? I'm more use to VMS where block equals
> 512 bytes. Then the final step, I guess, is how do I determine how much
> space is used. If I have that then I can subtract that from the partition
> size. The reason I'm trying to do this is I have a cron job that backs up
> projects files in the /usr mount point tree to a directory in the /home
> mount point tree. I need to calculate the size of the backup tar files per
> day with the free space left to schedule a clean up before I run out of
> disk space. The mount points were something like:
>
> hda1 /boot
> hda2 /
> hda3 /usr
> hdb1 {swap}
> hdb2 /var
> hdb3 /home
> hdb4 /opt
# df -h
HTH
- Darsha
| |
| Meat Loaf 2005-09-24, 5:52 pm |
| Captain Dondo wrote:
> Meat Loaf wrote:
>
> man du
> man df
Thanks!
Now I'm studying up on bash scripting to create the auto cleanup of old
backups so I'm sure I'll be back with questions. This newsgroup is the
greatest!
| |
| Captain Dondo 2005-09-26, 5:54 pm |
| Meat Loaf wrote:
> Now I'm studying up on bash scripting to create the auto cleanup of old
> backups so I'm sure I'll be back with questions. This newsgroup is the
> greatest!
>
man find
:-)
| |
| Meat Loaf 2005-10-12, 5:59 pm |
| Captain Dondo wrote:
> Meat Loaf wrote:
>
>
> man find
>
> :-)
I used date to create a timestamp to be included as part of the file name.
ts=$(date +20%y%m%d)
tar -czf /home/public/backup{$ts}.tar.gz /usr/users/lnk_awd/*
By using the df command I calculated that I could safely handle 64 backup
copies, which was more than I needed. I decided to cut it off at 4 weeks.
So I used:
ts=$(date --date='1 month ago' +20%y%m%d)
name=backup$ts.tar.gz
if [ -e $name ]
then
rm $name
fi
If there is something better I'm open for suggestions.
Thanks
|
|
|
|