Modify the /etc/fstab - add a new line for each file system you want mounted. Use sudoedit /etc/fstab to safely make the edits.
Some hints:
- Best to choose a native Linux file system for many reasons, not whatever file system the drive arrived from {insert store name here}.
- ext4 is a good all-around file system. If that isn't the type on the disk, you'll 98% want to change it.
- Changing to ext4 can be accomplished many different ways. gparted is commonly used, but gnome-disks can do it as well.
- Windows can't directly read ext4, but over a network with a samba share or using sftp (WinSCP), ext4 would be preferred.
- Mount using either the UUID, Partition LABEL, or LVM LV "path".
- Find the correct UUID using blkid command.
An example /etc/fstab mount line:
Code:
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=e3396778-bf33-42f5-8420-d1a31bdac7df /stuff ext4 nofail,noatime,errors=remount-ro 0 1
Here's another example:
Code:
/dev/vgubuntu/home /home ext4 noatime,errors=remount-ro 0 1
I'm using an LVM-Logical Volume above.
- # begins a comment in the fstab file.
- Parameter order matters.
- The first parameter in each fstab will be unique to your system. You can't just make up answers.
- A mount point is just an empty directory that already exists. Well, strictly speaking, it doesn't need to be empty, but when storage is mounted onto the directory, everything underneath it cannot be accessed. 99.99% of the time, that would be undesirable.
- Spacing isn't critical - 1 space or 20 are the same. In the "options area", no spaces are allowed between options. Tabs can be used with or without spaces.
- 1 line must be used for 1 mount. No wrapping allowed.
- Different file system types support different options.
- Use sudedit /etc/fstab to make edits to almost all system files. There are exceptions for 3 files (crontabs, sudoers, and passwd), which have dedicated editing commands.
- It is smart to backup any modified /etc/fstab files with your daily/weekly backups.
- UUIDs are not sensitive. They are automatically generated and we can force a new one to be generated if we like. The only purpose is to have a unique identifier for different storage objects.
- If you want to use LABELs, best never to mix case nor have any non-alphabetic characters; no spaces to avoid hassles.
Above, /home is a very important mount, so I don't have the nofail option. /stuff isn't as important. If that disk fails or is missing, I still want the OS to boot.
If you web-search using "ubuntu fstab", you'll find a how-to guide somewhere on *.ubuntu.com which explains UUIDs, LABELs, and lots of other options. An fstab with a broken line seems to break lines below it, so put your new partitions at the end/bottom of the file.
The format of this file hasn't changed in 15 yrs and is the same on all Linuxen that I'm aware.
Some handy commands for gathering storage information:
Code:
alias dft='df -hT -x squashfs -x tmpfs -x devtmpfs'
alias lsblkt='lsblk -e 7 -o name,size,type,fstype,mountpoint'
Add those to your alias file like any others, the you can just type dft or lsblkt to get the nicer output. There is a way to have lsblk include the UUID, but I don't use those much so my alias doesn't do that. Sorry.
If you don't know what this is, ignore it. :
If you have LVM storage, there are some things I do to make the mount entries more useful by containing the VG and LV names. LVs have multiple links, any of which can be used for mounts. Think of it like looking inside different Windows at different couches in a house. You'll see the same couch, just how you see it is different, but for mounting, that doesn't matter at all. Recent installers have selected about the single most useless "window" to look at the couches, IMHO. I always manually change that spec in the fstab to be human useful, and much shorter.
Bookmarks