To add storage to an Ubuntu server, attach a disk or volume, identify it with lsblk, partition and format it if it is new, then mount it at a suitable directory. For storage that should be available after reboot, add its UUID to /etc/fstab and test the entry before restarting.
Choose the right kind of storage
“Add storage” can mean adding a physical drive to a server, attaching a virtual disk through a cloud or hypervisor control panel, or connecting network storage such as NFS. The exact attachment procedure depends on the hardware or hosting provider; Ubuntu’s job is to detect and configure the device once it is available.
- Local disk: A SATA, SAS, or NVMe drive is useful for capacity or local performance. Confirm that the hardware, controller, and server support the drive.
- Virtual or cloud volume: Attach or create the volume in the provider’s interface first. Some systems expose it immediately; others require a rescan or reboot.
- Network storage: NFS and similar services mount remote storage rather than adding a local block device. Their setup and availability requirements differ from those for a disk.
Before changing anything, check whether the server already has free space in its existing volume group or partition layout. Extending an existing filesystem may be simpler than creating a separate mount point. Also decide what data will go on the new storage: application uploads, backups, databases, and system files have different performance and reliability needs.
Identify the new device safely
After attaching a disk, inspect the system’s view of its block devices:
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,UUID
Look for a device with the expected size and no existing mount point. Names such as /dev/sdb and /dev/nvme1n1 are examples, not guarantees: device names can change between boots or differ across systems. Never assume that the newest-looking device is empty. Check its size, partitions, filesystem, and existing data before proceeding.
You can also review sudo fdisk -l for partition details and sudo blkid for filesystem identifiers. If the disk is not visible, check its attachment in the hypervisor or cloud console, then review system logs with dmesg. A rescan may be needed in some environments, but the method depends on the storage controller and provider.
Partition and format a new disk
Partitioning and formatting can destroy data. Do not run these commands on a disk that contains files you need. The following example assumes a confirmed, empty disk at /dev/sdb and creates one GPT partition occupying the disk:
- Open a partition editor with
sudo parted /dev/sdb. - At its prompt, enter
mklabel gpt, thenmkpart primary ext4 0% 100%, andquit. - Check the result with
lsblk. The partition will commonly appear as/dev/sdb1. - Create an ext4 filesystem with
sudo mkfs.ext4 /dev/sdb1.
Use the actual device and partition names reported on your server. A GPT partition table is suitable for most modern systems. The mkfs.ext4 command initializes a filesystem and overwrites filesystem structures; it is not a harmless inspection step. Other filesystems may be appropriate for specific workloads, but select one deliberately and ensure Ubuntu has the required support.
Mount the filesystem and make it persistent
Create a directory to serve as the mount point, then mount the new filesystem. For example:
sudo mkdir -p /srv/data
sudo mount /dev/sdb1 /srv/data
Confirm the filesystem is mounted and check available capacity with findmnt /srv/data and df -hT /srv/data. A mount point should generally be an empty directory: mounting over a directory that already contains files hides those files until the filesystem is unmounted.
A command entered with mount normally lasts only until unmounting or reboot. To mount the filesystem at startup, use its UUID rather than a device name, which is more stable. Get the UUID with sudo blkid /dev/sdb1, then back up and edit /etc/fstab:
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Add a line using the UUID from your own output, replacing the example value:
UUID=YOUR-UUID /srv/data ext4 defaults 0 2
Save the file and test it before rebooting:
sudo mount -a
findmnt /srv/data
If mount -a reports an error, correct the entry before restarting. A bad fstab line can cause boot problems. For a removable disk or a cloud volume that might not be present during boot, options such as nofail may be appropriate, but consider the consequences: services could start without the expected data directory mounted.
Permissions, capacity, and operational care
A mounted filesystem is not automatically writable by the application that needs it. Filesystem ownership and permissions control access. For example, a service may need a directory owned by its dedicated account rather than by your login user. Set ownership narrowly—for instance, with sudo chown serviceuser:serviceuser /srv/data only if that account and access pattern are correct. Avoid making an entire data directory world-writable with chmod 777.
- Monitor space with
df -h; usedu -xhd1 /srv/datato find large directories without crossing into other mounted filesystems. - Keep independent backups. A second disk in the same server is not a substitute for a backup stored elsewhere.
- For databases or other critical services, plan maintenance and test recovery before moving live data.
- Check the provider’s snapshot, resizing, and deletion behavior for virtual volumes. A larger virtual disk may still require partition and filesystem expansion inside Ubuntu.
Common problems and useful alternatives
If the disk appears in lsblk but the mount fails, check that you are mounting the partition rather than the whole disk, that the filesystem type is correct, and that it is not already mounted elsewhere. An “unknown filesystem” message can indicate a missing driver, an unsupported format, or a damaged filesystem; do not reformat it just to clear the message if it may contain data.
If the mount works until reboot, check the UUID and spelling in /etc/fstab, then run sudo mount -a. If storage is visible but capacity has not increased after a cloud-volume resize, the partition and filesystem may still need expansion. The exact steps depend on whether the disk uses a partition, LVM, and the filesystem type; inspect the layout before changing it.
For flexible growth or multiple disks, Linux LVM can combine storage into logical volumes that are easier to resize than fixed partitions, but it adds a management layer. RAID can improve availability or performance in some configurations, yet it is not a backup and needs deliberate design. For shared files across multiple servers, NFS or a provider’s managed file service may fit better than attaching a disk to one machine.
Frequently Asked Questions
How do I add a second hard drive in Ubuntu Server?
Attach the drive, identify it with lsblk, verify it is the intended disk, then partition and format it if it is blank. Mount it at a directory and use its UUID in /etc/fstab for a persistent mount.
Does Ubuntu automatically mount a new disk?
Not necessarily. Ubuntu may detect a disk without mounting it. A disk must have a usable filesystem and a mount point; persistent mounting usually requires an /etc/fstab entry or an appropriate storage-management service.
Should I use /dev/sdb or a UUID in fstab?
Use the filesystem UUID in most /etc/fstab entries. Device names such as /dev/sdb1 can vary with hardware detection order, while a filesystem UUID identifies that filesystem.
Can I add storage without formatting the disk?
Yes, if it already has a compatible filesystem and you intend to keep its data. Inspect its partitions and filesystem first, then mount the correct partition. Formatting creates a new filesystem and can erase existing data.
Can I expand Ubuntu’s existing storage instead?
Often. If the available space is unallocated on the same disk, or an existing LVM volume group has free capacity, you may be able to expand the current partition or logical volume and filesystem. The safe procedure depends on the layout, so inspect it before making changes.