The solution is to add them to /etc/fstab
, but with options to prevent them from being automatically mounted. The option you want is noauto
rather than auto. For example, to prevent a windows partition from being mounted, you could add an entry like the following:
UUID=C2A281E4A281DCF3 /media ntfs-3g defaults,noauto 0 0
You can run blkid
to retrieve the partition UUID:
sudo blkid
See "Using UUID" in the Ubuntu Docs.
Or, to make it more self-documenting and simpler, although not quite as fail-proof, I have switched to using disk labels rather than UUIDs. You just need to make sure the label is descriptive and unique; unlike using UUIDs, labels are not guaranteed to be unique, but I've never run into a problem, and it's more convenient, as you can swap a different partition by using the same label, and no need to modify /etc/fstab
, or to run blkid
.
Contrast the above entry with this one:
LABEL=Win_sys /media ntfs-3g defaults,noauto 0 0
A good explanation of fstab options can be found on the ArchWiki and on the Ubuntu Docs.
You can format the partition in "EXT4" and use it as normal partition, and then create a swap file there like in :
https://support.rackspace.com/how-to/create-a-linux-swap-file/
However, you have to mount this new partition at startup by adding it to the fstab file because a partition created after installing ubuntu will not be automatically mounted unless you add it to the fstab partition, so in summary you will mount the new partition then you will mount the swap file into the new partition, which is a very bad idea.
Why don't you just collapse this partition with any other partition and create the swap file into the root partition for example!
Best Answer
Please add the
noauto
option in/etc/fstab
for your Ubuntu system'ssda10
partition.