Command to List All folders Contained in a Specific Partition
Hi everyone,
I've been experimenting with Linux for some time however I still consider myself to be a newbie... I seem to spend far more time in Google than in the terminal! I've been trying to set up a headless --Ubuntu Server 14.04.3 LTS--. (Non-Production) machine to act as the host for multiple VirtualBox VMs. I intend to set up the server using the concepts described in LHammonds Excellent Guide How to Install and Configure an Ubuntu Server 14.04.1 LTS The partitioning scheme in his example is as follows: (Note: The partition sizes shown are my proposed initial settings with lots of unallocated space for future expansion.) /boot = 0.25 GB (Outside LVM) /root = 2.75 GB /swap = 64.00 GB (double the 32GB of RAM) /home = 300.00 GB (I'm assuming the default location of the VirtualBox VMs will be somewhere under the /home directory) /tmp = 1.00 GB /usr = 2.50 GB /var = 2.00 GB /srv = 100.00 GB (This will contain the files stored in the Samba share) /opt = 1.00 GB (This will contain specific software added but may not be utilized at all) /bak = 500.00 GB (Temp location of LVM Snapshots) (7TB Unallocated for future expansion) I'm in the process of installing and configuring the Lab Server and would like to get to know/understand the file structure. Is there a command that will list all of the folders contained in each of the above INDIVIDUAL partitions? This will serve two purposes... a) It will help me ensure the partition that ultimately contains the VM.vmdk files is allocated sufficient disk space. b) It will help me understand the Linux file structure. Also, any constructive comments re the proposed partitioning scheme would be welcomed. I would be particularly interested in comments on the /tmp and /bak partition sizes... are they ridiculous or are they reasonable considering the server will only be a host for a max of 10 VMs (I plan to keep a few Operating System ISOs for creating the VMs in the /srv partition. Please note... I know this system is a complete over-kill for it's intended use... I'm using this structure to to help me learn. Thank you all (in anticipation for your replies) |
Run:
Code:
$ sudo ls -la <partition mount point> Code:
sudo find <partition mount point> -type d |
Hi there,
To list all of the folders contained in each of the above INDIVIDUAL partitions, I'd suggest you use the "find" command. Something like this should do: Code:
for partition in /boot /root /swap /home /tmp /usr /var /srv /opt /bak Regarding the default location for VMs, yes it us under your home directory. This is a configurable preference, though, so you can keep them anywhere you want. It might make more sense to put this in a more obvious filesystem if its own if that's the main purpose of this server. Regarding partition sizes, you probably want quite a bit more space in /usr. Swap space is not in a mounted file system. I hope you never need that much swap space ;-) A single large swap space makes sense if you intend allocating more memory to VMs than your server has, and don't create any swap partitions in the VMs themselves. Alternately you can allocate swap space to each VM in a virtual disk, and keep allocated memory below what you physically have, in which case the host should never swap, and you can keep this much smaller. Good luck! Clifford |
Hi again,
Some additional info, after reading kilgoretrout's reply, as I might have misunderstood the requirement ;-) "ls -a" will list all files & directories in a particular directory. Adding "--recursive" will also list the contents of subdirectories. My "find" command on the other hand is recursive by default. The "-xdev" option stops it from traversing into filesystems other than the one containing the requested directory. For example, "find / -xdev" will not find files in /usr if that is a separate filesystem. The "-type d" option lists only directories, and not files or other objects (devices, fifos, etc). |
I think cliffordw and I have been cross-posting not catching each others edits. The methods are essentially the same but you do need to run with sudo otherwise files and directories that have root only read permissions will not be listed.
|
kilgoretrout & cliffordw... Thank you both very much for your replies, and a special thank you to cliffordw for the extra detail.
Very helpful. |
All times are GMT -5. The time now is 05:37 PM. |