Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On Debian, I have multiple hard drives, how do I know where /var/www is?

Bonus: How do I check the capacity and consumed capacity and of my drives?

share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted

You can find where /var/www is, by checking where it (or /var) is mounted, using the mount command.

To check the available/used space on the drives, try df (or df -h for more readable output). It will show the used and available space in all the mounted partitions. E.g.

-> % df -kh
Sist. Arq.       Tam  Usad Dispon. Uso% Montado em
rootfs           94G   34G     60G  36% /
/dev            2,9G     0    2,9G   0% /dev
run             2,9G  484K    2,9G   1% /run
/dev/sda1        94G   34G     60G  36% /
[... the rest was snipped, I have many more partitions ...]

Also, df /path/to/file works (at least on Linux):

-> % df /var/log
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda1       97667596 34853688  62813908  36% /
share|improve this answer
2  
Mount won't tell you if any part of the path is a symlink. –  XTL Jun 8 '12 at 7:22
add comment

You fail to mention your operating system, but on linux, this works:

$ df /path/to/some/file/or/directory
Filesystem                          1k-blks    Used   Avail Cap Mounted
/dev/harddisk_partition 8388348 5187768 3200580 62% /home/username
     ^^^^^^^^^^^^^^^^^^
share|improve this answer
1  
This is standard behaviour for df(1). It works elsewhere, too. –  Alexios Jun 7 '12 at 20:43
1  
Not for HP-UX ;o) –  jippie Jun 7 '12 at 20:59
1  
Right. HP-UX just has to be different. (bad memories) –  Alexios Jun 8 '12 at 3:35
    
This will work through symlinks, too. On a Red Hat type box, say df /etc/grub.conf and it will probably tell you the disk free space on your /boot partition, not on root, where /etc probably lives. –  Warren Young Jun 8 '12 at 21:25
add comment

Use mount to look at your disk mount points. Look for the longest match for /var/www and that's your disk. In my case, it's /dev/sda2.

[mpenning@Bucksnort ~]$ mount
/dev/sda2 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
[mpenning@Bucksnort ~]$

Drive space consumption in KBytes, per mount point:

[mpenning@Bucksnort ~]$ df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             30759872  22835672   6361680  79% /
tmpfs                  1947664        12   1947652   1% /lib/init/rw
udev                   1943240       104   1943136   1% /dev
tmpfs                  1947664         0   1947664   0% /dev/shm
/dev/sda1              1441280     67136   1300928   5% /boot
[mpenning@Bucksnort ~]$
share|improve this answer
    
What do you mean "Look for the longest match for /var/www" –  Kirk Jun 7 '12 at 20:33
1  
/dev/sda2 is mounted on /. That is the longest path that matches /var/www. However, someone below mentioned a better method using df /var/www... that will give you the drive mount directly. –  Mike Pennington Jun 7 '12 at 20:34
    
It's also wrong if anything in that path is a symlink. –  XTL Jun 8 '12 at 7:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.