File System in linux vs File System in Windows

ravikumar js

New Member
Credits
17
Hello All,
Want to know is there any concept in Linux like windows C drive, D drive etc..(partition)
Please let me know.

Thanks,
Ravi
 


arochester

Moderator
Staff member
Gold Supporter
Credits
2,109
No. Linux disks are called things like sda and sdb. Then partitions are subdivided into things like sd1, sda2 and sda3
 

jglen490

Well-Known Member
Credits
3,076
Unless you initially set up your Linux environment to have a separate partition for each of those directories, they are not allocated separate spaces. The partition (sda1, sda2, etc.) has the space allocation. So if your allocated, as an example, 500MB to sda1 (because it's the efi partition), and 20GB to / on sda2 (because that's the "root" partition), and 100GB to /home on sda3 (for your user data and user config files), that's where the space is allocated. Any subdirectories will use as much space as they require for normal functions. These space allocations are either determined by default at install or by your actions at install. The default is to put everything under / and use the entire disk for that.

If you want to know what each partition looks like, use df -h which will produce something like this:
Code:
[email protected]:/$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  1.7M  1.6G   1% /run
/dev/sda2        32G  8.6G   22G  29% /
tmpfs           7.8G   52M  7.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1       476M  7.8M  468M   2% /boot/efi
/dev/sdb1       458G  189G  246G  44% /home
/dev/sda3       172G   61M  163G   1% /home/extra
tmpfs           1.6G   16K  1.6G   1% /run/user/1000
 

dos2unix

Well-Known Member
Credits
2,785
jglen is right about the filesystems. I use df -h quite a bit.
But what if you want to the size of individual directories on a file system?
Sometimes I want to know what is taking up all the space on my filesystem.

cd /var
du -sh *
cd log
du -sh *
cd some_application_log_directory
ls -l
 

Tolkem

Well-Known Member
Credits
1,920
jglen is right about the filesystems. I use df -h quite a bit.
But what if you want to the size of individual directories on a file system?
Sometimes I want to know what is taking up all the space on my filesystem.

cd /var
du -sh *
cd log
du -sh *
cd some_application_log_directory
ls -l
You can use this
Code:
tree -L 1 -h
will list files and their sizes in human readable form in a tree view mode form appending K, M or G when appropiate. You can remove -L 1 to list recursively or increase the level tree will go down the directory, i.e, use -L 2 ... 3 ...
or
Code:
ls -1s --block-size=K/M/G *
will list files and their sizes in human readable form, where K=Kilobytes, M=Megabytes and G=Gigabytes, so use either one of them as you need.
You may also specify one or different file types
Code:
ls -1s --block-size=M *.{jpg,zip,mp3}
will list every .jpg, .zip and .mp3 files only within the current dir and their sizes in megabytes.

There's also a tool
Code:
ncdu


It's available in every distro. Read here for more info https://dev.yorhel.nl/ncdu

Lastly, you can change the view mode in your file manager to show more details like size, file type, mtime, atime and anything else your DE's file manager provides.

Hope this helps! :)
 

jglen490

Well-Known Member
Credits
3,076
All great suggestions!

Consider this, routinely monitor your filesystems at a high level - with your eyeballs! Get to know how your system is behaving. When a partition starts creeping up in size and you know you haven't done anything to contribute, then dive deeper using some of the tools that others have suggested above. And never forget to make backups of what is important to you. Stuff that comes most from your creativity is the stuff that is easy to lose, without a backup and recovery plan.

Make it a habit to pay as much attention to your filesystems as you do to content on the 'nets ;) You will soon discover that all kinds of good habits will make computing life very easy.
 


Members online


Latest posts

Top