Partitions, slices, filesystems and mountpoints

I just can't get my head around how FreeBSD organises data on a disk. I've read numerous articles but have a mental block, specifically around mountpoints and partitions.

How do I establish exactly where a file resides, i.e. on which disk if there is more than one? And how would copy or move /var or /tmp from ada0 to ada1?
 
The traditional MBR layout uses slices and partitions. The FreeBSD 'slice' is similar to an MS-DOS primary partition (hence the confusion). It's possible to create a maximum of four slices (a.k.a. DOS primary partitions) on a disk. Within a slice you create partitions. This would result in names like ada1s1a, ada0s2d etc. The s refers to the slice number and the a, b, etc to the partition within that slice. Notable exception is the c partition, it always covers the entire slice. The newer GPT layout only has partitions (there's no relation to the traditional DOS partitions), and I think the limit is 256. Those names look like ada1p1 or ada0p5.

You can tell which filesystem is mounted where by looking at the output of the mount (no arguments) command. Compare the filesystems with the full path of the file in question and you should be able to figure out which drive and partition it lives on.

Copying or moving filesystem is a bit tricky. The best way is to mount the new filesystem temporarily on /mnt/ and move the files. Then adjust /etc/fstab to mount the new filesystem at the correct position. Unmount the old one and mount the new (or simply reboot).
 
Use mount without parameters or df -h to show mounted filesystems. I prefer the second. The first column shows the device, the second shows where it is mounted.
 
Code:
/dev/ada1p1 on /mnt/disk (ufs, local, soft-updates)
refers to a 1TB disk which is where I would like to designate as a data partition so I guess I need to change the entry in fstab to
Code:
/dev/ada1p1  /var
after copying all the files from /var to /mnt/disk

I suppose, since there is nothing using this disk, that I may as well change the filesystem to ZFS, although I don't really understand it - there just seems to be too much to it.
 
Back
Top