To enable auto-mounting of your Lightsail external storage disks after reboot on Ubuntu, you’ll need to configure the /etc/fstab
file. Here’s how to do it:
Step 1: Connect to Your Instance
Connect via SSH to your aws-kirei-care-2023-jp-2
instance.
Step 2: Check Current Disk Status
First, verify the disks are attached and check their current mount status:
# Check all block devices
lsblk
# Check disk UUIDs (recommended for fstab)
sudo blkid
# Check current mounts
df -h
Step 3: Create Mount Points (if not already created)
# Create mount directories
sudo mkdir -p /mnt/kireicare-disk-2024
sudo mkdir -p /mnt/kireicare-disk-2025
Step 4: Get Disk UUIDs
Get the UUIDs for your disks (more reliable than device names):
sudo blkid /dev/xvdf
sudo blkid /dev/xvdg
This will output something like:
/dev/xvdf: UUID="12345678-1234-1234-1234-123456789abc" TYPE="ext4"
/dev/xvdg: UUID="87654321-4321-4321-4321-cba987654321" TYPE="ext4"
Step 5: Configure Auto-Mount in /etc/fstab
Edit the fstab file:
sudo nano /etc/fstab
Add these lines at the end (replace UUIDs with your actual ones):
# Lightsail Additional Disks - Auto Mount
UUID=12345678-1234-1234-1234-123456789abc /mnt/kireicare-disk-2024 ext4 defaults,nofail 0 2
UUID=87654321-4321-4321-4321-cba987654321 /mnt/kireicare-disk-2025 ext4 defaults,nofail 0 2
Step 6: Test the Configuration
Test the fstab configuration without rebooting:
# Test mounting
sudo mount -a
# Verify mounts worked
df -h
Step 7: Set Proper Permissions (Optional)
If you want your ubuntu user to have access:
# Change ownership to ubuntu user
sudo chown ubuntu:ubuntu /mnt/kireicare-disk-2024
sudo chown ubuntu:ubuntu /mnt/kireicare-disk-2025
# Set permissions
sudo chmod 755 /mnt/kireicare-disk-2024
sudo chmod 755 /mnt/kireicare-disk-2025
Step 8: Test with Reboot
sudo reboot
After reboot, check if disks are mounted:
df -h
lsblk
Important fstab Options Explained:
UUID=...
- Uses UUID instead of device path (more reliable)ext4
- File system type (adjust if different)defaults
- Standard mount optionsnofail
- System boots even if disk fails to mount0
- No dump backup2
- Check filesystem on boot (after root filesystem)
Troubleshooting:
If disks don’t auto-mount:
-
Check for errors:
sudo journalctl -u local-fs.target
-
Verify fstab syntax:
sudo mount -a
-
Check disk health:
sudo fsck /dev/xvdf sudo fsck /dev/xvdg
Your disks should now automatically mount to /mnt/kireicare-disk-2024
and /mnt/kireicare-disk-2025
on every reboot!