Attaching volume to already existing folder deleted all the data in digital ocean

Viewed 5

I bought a 100 gb volume and accidentally attached it to my var folder. Now all the previous data is deleted

command I ran mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_volume-sgp1-01 /var

How can I undo this last action in digital ocean

1 Answers

Unmounting returns you all of the data

  1. Get the volume’s mount point with df if you don’t already know it sudo df --human-readable --print-type
  2. Unmount the volume with umount. sudo umount --verbose /mnt/use_your_mount_point

if it shows that "device is busy", kill the processes

  1. get the process by sudo lsof +f -- /mnt/use_your_mount_point
  2. kill the process found ps -ef | grep 1725 <--> ps -ef | grep <pid> AND/OR kill -9 pid
Related