Disk Overview---Help Me Understand What I'm Seeing
I hope someone can help me make sense of disks in Linux. I've read the articles and links and such. The problem is I'm having a hard time applying what I've read and "learned" so far with real world situations. I'm getting a little overwhelmed and confused, so I'm hoping someone can help me clarify things.
I think I understand that when you install Linux you have some partitioning and formatting options, like anything else. If you create only a swap and boot partition, your /etc/fstab might look something like this: Quote:
Now, that's a fairly basic system. Let's say I run across an fstab that looks like this: Quote:
So, even though an "ls /" would list all of these directories, they still technically live under / but not necessarily on the same drive or partition? Does this mean that all of the other directories usually found under / (/lib, /tmp, etc) are still under this main partition and contribute to the overall size of /? Am I understanding disk layout properly in this context? |
without getting LVM, RAID and anything, here's my fstap
/dev/sda2 swap swap defaults 0 0 /dev/sda1 / ext4 defaults 1 1 /dev/sdb1 /home/ozan ext4 defaults 1 1 #/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 let's ignore the virtual systems like proc and sys, and we got: /dev/sda2 swap swap defaults 0 0 /dev/sda1 / ext4 defaults 1 1 /dev/sdb1 /home/ozan ext4 defaults 1 1 my swap and root is on sda. my home is on sdb. everything in / in in /dev/sda1 exept /home/ozan, because it is on /dev/sdb1. you can do something like this; /dev/sda1 is / /dev/sda2 is /home/ozan /dev/sda3 is /usr /dev/sda4 is swap in that case; sda1 is gets anything on / exept /home/ozan which is on sda2 and /usr which is on sda3. |
Okay, let me give another more concrete example of where my confusion stems from (a RL example that I just encountered).
I did df -h and part of the output was this: Quote:
28G /var Now, up above it shows that /var is 4.9GB total. Soooo...how is is that du -sh on that same directory shows me that I am using 28GB? Is it that even though /var/lib/pgsql is actually mounted somewhere else it's still considered part of /var when I view disk usage? That doesn't make sense to me because...well, it just doesn't. I'm probably over-thinking it because the base is that I know I can do a du -sh on the full pathname /var/lib/pgsql to see what's making up that 22GB that's in use, but I guess I want to understand the theory behind why it works like this. If this is too much to be tackling in this thread, let me know. I think part of the hang-up I have to learning Linux is getting caught up in semantics. |
In your example you have :
/dev/mapper/MainVG-var on /var using 306M /dev/mapper/MainVG-pgsql on /var/lib/pgsql using 28G so du that give you the actual disk usage will give you 306M+28G that's the result you have. Where is the problem for you, i don't understand ? when you use df it give you disk_size disk_usage disk_space_left percent_usage. |
The confusion here is that du will count disk usage on that directory without caring at all about what device the info is into. That means it will traverse devices if needed, even if it's a network share mounted via nfs.
Check the du man page, scpecially the -x option. |
All times are GMT -5. The time now is 08:04 AM. |