On Unix systems, which includes Linux, partitions are physical space that you dedicate to a path. If you had only one partition, it would necessarily be allocated to '/', since this partition is mandatory.
If you wish to allocate physical space to /var/www/data
using a specific partition, here is what you should do:
- Create a new partition (on the same disk or another disk) and format it ;
- Stop the services using the directory you wish to use as a mount point ;
- Move the data in this directory to another place that has enough space ;
- Find the identifier of your new partition ;
- Mount the new partition on the path you wish to use ;
- Put your data back in the directory.
- Add the mount configuration in
/etc/fstab
to make sure your partition is mounted at startup.
Step 3 is important. If you don't do it, this is what will happen:
- Your data is stored on the original partition (let's say it's
/dev/sda1
for example) ;
- You mount the new partition on top of the directory (let's imagine this is
/dev/sdb2
for example) ;
- You see the directory being empty, because
/dev/sdb2
doesn't contain anything. The data are still stored in /dev/sda1
, but you can't see them or remove them anymore, unless you unmount /dev/sdb2
first.
This is why it's important to clean the directory before you mount a partition on it.
You can find more informations on using partitions on Linux on this page.