I have a newly formatted ext4 1TB HDD that I intend to use only for data. This is a single user machine though the drive or folders within it may be shared out via NFS .
Is there any advantage to partitioning the drive?
I have a newly formatted ext4 1TB HDD that I intend to use only for data. This is a single user machine though the drive or folders within it may be shared out via NFS .
Is there any advantage to partitioning the drive?
One ext4 partition will suffice. You can assign folders within it with differing rights in case you have multiple users.
No Partition or 1 Partition?
It is possible to format the whole disk without any partition and without any partition table.
However, it is recommended that You have at least one partition covering the whole disk. See answers to How do I add an additional hard drive? in this site for other examples of creating a single partition covering the whole drive.
I suppose you want to know the advantage of having more than one partition in this data disk. Here are some advantages:
Multiple Users
Let us suppose my wife is a telenovela fan and wants to setup a way to download 6 episodes every week. My son is a gamer and wants to save his steam game data in the extra drive.
If I have only one partition in a few weeks the partition will be full of TV episodes and my son won't be able to save his game or vice versa.
One solution is to create two partitions. Even if the Telenovela partition is full the game-data partition will have space and the other way around.
There are other ways of assigning disk quota to users: Using 'quota' for disk limits that does not require creating multiple partitions.
Second Drive as a File Server
This use-case is similar to above, but instead of having multiple local users, you have other users who use the data drive as a network drive and dump their data in this drive. Even though there are ways to manage network data storage quota in a file server, you may want different partitions for different network users.
Partitions v Quota
Using user and or group quotas for local or remote users' data needs is the "proper" way to go about it. However, setting it up may be daunting to new users especially those who are not familiar with the command line. One advantage of this approach is one can change the quotas without messing with the partitions.
On the other hand, setting up the new disk with two or more partition seems easier especially with a GUI application like Gparted. You don't have to learn and remember new commands. On the negative side, if you need a different quota assignment, you have to resize the partitions which always involves a risk of data loss resulting from mistakes or power failure etc.
Single User
It is harder to think of a situation where a single user may need two data partition, but it is not impossible.
One possibility is you are working on two different data intensive projects and one of them may generate huge amount of data filling up the whole disk. If that happens the code for that project will stop working at the same time the second project will also fail if the data from two projects are not in separate partitions.
The Future
What if one needs a second partition in the future? If one created a single partition spanning the whole disk, one will be able to shrink the partition and create more partitions in the empty space.
If one formats the disk without creating a partition table and a partition, and put data in it. One won't be able to create a partition later without erasing the data in the disk.
Hope this helps
Seeing that the original author describes the disk as "newly formatted" and only to be used for data, not as a system disk, the question might also be interpreted as whether to create a partition table on the drive containing a single partition, as opposed to just creating the filesystem directly on the raw block device (e.g.
/dev/sda
).If that is the case, I would definitely recommend creating a partition table containing a single large partition, for the following reasons:
Also, if you do decide to create the filesystem directly on the device without a partition table, make sure that the partition table is completely gone if it's a GPT partition table.
Unlike legacy MBR partition tables which only reside at the beginning of the drive, GPT keeps an additional copy of the partition table at the end, for recovery purposes in case the primary instance of the partition table gets corrupted.
If the initial partition table is missing due to it now being occupied by the filesystem superblock, partitioning tools might see the partition table as corrupted, and therefore try to repair it by overwriting the beginning of the drive with the backup kept at the end of the drive, thus corrupting the filesystem. No partitioning tool would hopefully ever do this without asking, but you never know.
A solution for the last issue would be to wipe both instances of the GPT partition table completely. This can be done using the "zap" feature of gdisk (GPT fdisk), accessible by entering the "experts mode" by pressing X in the initial menu, then Z for "zap". (Needless to say, make sure that you have selected the correct block device!)
The only apparent benefit for skipping the partition table on a physical disk, would be if every byte counts, and you have a specific purpose for the additional 2048 sectors (1 MiB) of storage at the beginning of the disk.
Another reason could be if you're using full disk encryption on the device with the LUKS header located elsewhere, so that it becomes more difficult to identify the contents as an encrypted filesystem rather than just random data. (Some people might call this security through obscurity.)
If legacy compatibility is a concern, an MBR partition table could be used rather than GPT. However, accessing a GPT disk would only cause issue on very old systems. If that is the case, it might even be worth considering using Ext3 or XFS rather than Ext4.
For virtualization purposes where disks may be moved around and resized at will, using disks containing filesystems without a partition table makes better sense, because it allows for more flexibility. For instance, the filesystem can be resized without modifying the partition table, and the data is easier accessible outside of the virtual machines, e.g. when mounting the partition on the VM hypervisor host.
One, sometimes, important aspects of partitioning on non random-access devices, like rotational HDDs, is localization of related data. Performance can be orders of magnitude better with proper localization. File systems tries to do good in this respect by keeping directories together in cylinder groups, but as time passes fragmentation becomes a fact. By using partitioning it is possible to keep related data together. Most people won't need this performance boost, but it is one reason for partitioning.
Also, there's the case where you want to have different filesystems on your disk, for various reasons. Then you have to partition. As much as you believe you will only ever have the need for one partition of one specific filesystem type, and one user, it may turn up wrong, and your needs six months from now might be different. 640KB of RAM wasn't enough for everyone after all.
There is also the case of security. There might be files you want to guard safe from e.g. ransomware. You don't want them mounted at all times, and then maybe only from certain virtual machines where you don't do promiscuous web browsing etc. So keep them in a separate partition.
I could tell a number of other more fringe reasons for wanting to partition. I am sure I have had over a dozen reasons during my 40 years of computing. I always give the advise: "keep some space for yet to be determined needs". One good thing is to use LVM to manage your space. Maybe just one disk won't be enough for the only "partition" (or logical volume). Then it is great to have the potential to have one volume span several disks. It comes with a performance trade-off, but the flexibility is really paying off, for a lot of us.
This question could be considered opinion based.
The main benefit to partitioning would be to keep your
/home/
or other documents separate from your system partition. In the event that you want to wipe the partition with your operating system, the partition with your other documents could remain untouched.However, In the matter of using the entire drive for storing non-system files, there is no benefit to partitioning that cannot be accomplished with organized folders. In fact, if you use partitioning for the purpose of organization, you actually reduce flexibility and, in effect, waste space.
Hard Drive Partitioning is useful when:
Otherwise partitioning will create complications, for example insufficient space on one partition and too much space on another.
P.S. You might think of several partitions on ONE DRIVE to have a RAID. The answer is NO. The performance will drop at least twice.
I "always" set up LVM. You can use the entire physical disk for a LVM partition. Then create logical volumes which can be expanded if necessary, without committing to a set volume/partition plan from the outset. Because you never know what tomorrow looks like.
Another major upside of LVM is that if you need to migrate your data to a new disk, for whatever reason, you can just add a new physical disk to the volume group and move the logical volumes to it, before removing the original disk(s) from the volume group and computer afterwards - with no additional configuration needed.