user5128984
user5128984

Reputation:

Auto mount Google cloud computing disk in Centos (using /etc/fstab)

I'm currently setting up a server @ Google Cloud computing, everything works fine except I'm having problems automatically mount the secondary disk to the system.

I'm running centos 6 / cloudlinux 6. I can mount to secondary disk without problems after boot with the following command: "mount /dev/sdb /data"

Please find below the log of /etc/fstab:

UUID=6c782ac9-0050-4837-b65a-77cb8a390772 / ext4    defaults,barrier=0 1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
UUID=10417d68-7e4f-4d00-aa55-4dfbb2af8332 / ext4        default         0 0

log of df -h: (*after manual mount)

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       9.8G  1.2G  8.2G  13% /
tmpfs           3.6G     0  3.6G   0% /dev/shm
/dev/sdb         99G   60M   94G   1% /data

Thank you already in advance,

~ Luc

Upvotes: 0

Views: 2275

Answers (1)

Jesse
Jesse

Reputation: 8393

Our provisioning scripts look something like this for our secondary disks:

# Mount the appropriate disk
sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/sdb /your_path

# Add disk UID to fstab
DISK=$(sudo blkid -s UUID -o value /dev/sdb)
echo "UUID=$DISK /your_path a ext4 defaults 0 0" | sudo tee -a /etc/fstab

Upvotes: 5

Related Questions