• Skip to primary navigation
  • Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

mount

Mounting Duplicate UUIDs

by Ulysses · Jan 12, 2021

While trying to recover a directory from backup, I ran into an issue with duplicate uuids when trying to mount a recovered volume. The problem was the recovered volume had the same uuid as boot.

Here’s the original mount command I ran, but I was getting a wrong fs type error.

mkdir
mount -t xfs /dev/nvme3n1p2 /recover
mount: wrong fs type, bad option, bad superblock on /dev/nvme3n1p2,
       missing codepage or helper program, or other error

mkdir mount -t xfs /dev/nvme3n1p2 /recover mount: wrong fs type, bad option, bad superblock on /dev/nvme3n1p2, missing codepage or helper program, or other error

It turned out to be a duplicated uuid. To get around this problem, I ran -o nouuid.

mount -t xfs -o nouuid /dev/nvme3n1p2 /recover

mount -t xfs -o nouuid /dev/nvme3n1p2 /recover

Once the files were recovered, I unmounted volume and detached it from the instance.

Filed Under: Linux Tagged With: duplicate, mount, uuid

Linux Format USB Drive

by Ulysses · Jul 9, 2020

Here’s how to format a USB drive on Linux.

Plug in the USB drive to see mount point.

# scan for all drives
df -Th
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sdc1      fuseblk   30G   66M   30G   1% /media/ulysses/451B99AF225B48EC

# scan for all drives df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sdc1 fuseblk 30G 66M 30G 1% /media/ulysses/451B99AF225B48EC

Unmount USB drive.

umount /dev/sdc1

umount /dev/sdc1

Choose a file system type and run the appropriate format command.

# nfts format
mkfs.ntfs /dev/sdc1
# vfat format
mkfs.vfat /dev/sdc1
# ext4 format
mkfs.ext4 /dev/sdc1

# nfts format mkfs.ntfs /dev/sdc1 # vfat format mkfs.vfat /dev/sdc1 # ext4 format mkfs.ext4 /dev/sdc1

Filed Under: Linux Tagged With: 3.0, command line, format, mount, terminal, usb

AWS XFS Volume Setup

by Ulysses · Mar 31, 2020

Here’s how to setup a XFS volume.

file -s /dev/nvme2n1
mkfs -t xfs /dev/nvme2n1

file -s /dev/nvme2n1 mkfs -t xfs /dev/nvme2n1

Mount to /data.

mkdir /data
mount /dev/nvme2n1 /data

mkdir /data mount /dev/nvme2n1 /data

Add to /etc/fstab.

vim /etc/fstab
#
#
UUID=xxxxxxxxxxxxxxxxxxxxxx /data  xfs  defaults 0 0

vim /etc/fstab # # UUID=xxxxxxxxxxxxxxxxxxxxxx /data xfs defaults 0 0

Filed Under: Cloud, Linux Tagged With: aws, fstab, mount, nvme, volumes, xfs

AWS EFS /etc/fstab

by Ulysses · Dec 23, 2019

To automatically mount a EFS volume after each reboot, you’ll need to add the following format to /etc/fstab.

You can use the DNS name given by AWS.

fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0

fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0

Or the IP address.

10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0

10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0

Mount all with fake and verbose.

mount -fav

mount -fav

Filed Under: Cloud Tagged With: automatic, aws, efs, fstab, mount, reboot

AWS EFS Describe Mount Targets

by Ulysses · Nov 4, 2019

Here’s how to display mount targets of an EFS system via AWS CLI.

 aws efs describe-mount-targets \
--file-system-id fs-xxxxxxxx \
--profile default \
--region us-east-1

aws efs describe-mount-targets \ --file-system-id fs-xxxxxxxx \ --profile default \ --region us-east-1

Filed Under: Cloud Tagged With: aws, describe, efs, mount, targets

XFS Filesystem has duplicate UUID

by Ulysses · Oct 7, 2019

Here’s how to fix a duplicate UUID on a XFS file system.

mount -o rw,nouuid /dev/sda1  /data

mount -o rw,nouuid /dev/sda1 /data

Mounting with nouuid will work, but not after a reboot.

To avoid a duplicate ID, run this command to generate a new UUID.

xfs_admin -U generate /dev/sda3
Clearing log and setting UUID
writing all SBs
new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

xfs_admin -U generate /dev/sda3 Clearing log and setting UUID writing all SBs new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

Filed Under: Linux Tagged With: duplicate, generate, mount, uuid, xfs

NFS Client

by Ulysses · Jun 10, 2019

Services to check.

chkconfig nfs on
service rpcbind start
service nfs start
mount -a

chkconfig nfs on service rpcbind start service nfs start mount -a

If missing, install it.

yum install nfs-utils nfs-utils-lib

yum install nfs-utils nfs-utils-lib

Mount it.

mount -a
mount 192.168.1.200:/home /mnt/nfs/home

mount -a mount 192.168.1.200:/home /mnt/nfs/home

Add to /etc/fstab.

10.10.10.10:/home on /mnt/nfs/home type nfs (rw,noatime,nolock,bg,nfsvers=2,intr,tcp,actimeo=1800,addr=10.10.10.10)

10.10.10.10:/home on /mnt/nfs/home type nfs (rw,noatime,nolock,bg,nfsvers=2,intr,tcp,actimeo=1800,addr=10.10.10.10)

Filed Under: Linux Tagged With: fstab, mount, nfs, nfs-utils, rpcbind

Adding a XFS Volume

by Ulysses · Mar 7, 2019

Add a disk volume via cloud console. Then perform the following commands:

# check the new block
lsblk
# format
fdisk /dev/sdc
# create file system
mkfs.xfs -f /dev/sdc1
# get uuid
blkid /dev/sdc1
# vi /etc/fstab
UUID="xxxxxxxxxxxxxxxxxxxxx" /mnt/directory xfs defaults 0 0
# mount
mount -a

# check the new block lsblk # format fdisk /dev/sdc # create file system mkfs.xfs -f /dev/sdc1 # get uuid blkid /dev/sdc1 # vi /etc/fstab UUID="xxxxxxxxxxxxxxxxxxxxx" /mnt/directory xfs defaults 0 0 # mount mount -a

Filed Under: Linux Tagged With: add, fstab, mount, xfs

Mount and Unmount EFS

by Ulysses · Feb 1, 2019

Here’s the command to mount and unmount AWS EFS. Assuming the EFS IP address is 10.0.0.23.

Mount:

mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.0.0.23:/ /efs

mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.0.0.23:/ /efs

Umount:

# lazy unmount
umount -l /efs
# force unmount
umount -f /efs

# lazy unmount umount -l /efs # force unmount umount -f /efs

You may have to force it if it’s busy.

Filed Under: Linux Tagged With: efs, mount, umount

AWS EFS Userdata

by Ulysses · Dec 25, 2018

If you want to auto mount the EFS volumes when the instance is created, add the following script to userdata:

#cloud-config
repo_update: true
repo_upgrade: all
 
packages:
- amazon-efs-utils
 
runcmd:
- file_system_id_01=fs-12345678
- file_system_id_02=fs-34593405
- efs_directory_01=/mnt/efs
- efs_directory_02=/mnt/efs2
 
- mkdir -p ${efs_directory_01}
- mkdir -p ${efs_directory_02}
 
- echo "${file_system_id_01}:/ ${efs_directory_01} efs tls,_netdev" >> /etc/fstab
- echo "${file_system_id_02}:/ ${efs_directory_02} efs tls,_netdev" >> /etc/fstab
 
- mount -a -t efs defaults

#cloud-config repo_update: true repo_upgrade: all packages: - amazon-efs-utils runcmd: - file_system_id_01=fs-12345678 - file_system_id_02=fs-34593405 - efs_directory_01=/mnt/efs - efs_directory_02=/mnt/efs2 - mkdir -p ${efs_directory_01} - mkdir -p ${efs_directory_02} - echo "${file_system_id_01}:/ ${efs_directory_01} efs tls,_netdev" >> /etc/fstab - echo "${file_system_id_02}:/ ${efs_directory_02} efs tls,_netdev" >> /etc/fstab - mount -a -t efs defaults

Just add more if you have more mounts.

Filed Under: Cloud Tagged With: auto, aws cli, efs, mount

Copyright © 2012–2021