How to completely delete a GlusterFS volume [closed]
Asked Answered
E

4

8

I have some GlusterFS(Version 3.7.11) volumes created and started, after some test, I stopped hand deleted the volumes, but they are still remain in the GlusterFS servers.

For example, I have 3 servers, and bricks saved under /gfs:

[vagrant@gfs-server-2 ~]$ sudo gluster volume create test-vol gfs-server-1:/gfs/test-vol gfs-server-2:/gfs/test-vol gfs-server-3:/gfs/test-vol force
volume create: test-vol: success: please start the volume to access data
[vagrant@gfs-server-2 ~]$ sudo gluster volume start test-vol
volume start: test-vol: success
[vagrant@gfs-server-2 ~]$ mkdir /tmp/test

[vagrant@gfs-server-2 ~]$ sudo mount -t glusterfs gfs-server-1:/test-vol /tmp/test

[vagrant@gfs-server-2 ~]$ sudo touch /tmp/test/`date +%s`.txt
[vagrant@gfs-server-2 ~]$ sudo touch /tmp/test/`date +%s`.txt
[vagrant@gfs-server-2 ~]$ sudo touch /tmp/test/`date +%s`.txt
[vagrant@gfs-server-2 ~]$ sudo touch /tmp/test/`date +%s`.txt

[vagrant@gfs-server-2 ~]$ sudo ls /tmp/test/
1469617442.txt    1469617446.txt    1469617447.txt    1469617449.txt
[vagrant@gfs-server-2 ~]$ ls /gfs/test-vol/
1469617449.txt
[vagrant@gfs-server-2 ~]$ sudo umount /tmp/test

After delete the volume, I can still see the files remain in the GlusterFS servers:

[vagrant@gfs-server-2 ~]$ sudo gluster volume stop test-vol
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: test-vol: success

[vagrant@gfs-server-2 ~]$ sudo gluster volume delete test-vol
Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y
volume delete: test-vol: success

[vagrant@gfs-server-2 ~]$ ls /gfs/test-vol/
1469617449.txt
Euglena answered 27/7, 2016 at 11:10 Comment(0)
C
9

gluster volume delete does not delete the data from the back-end, you would need to manually delete them from the bricks. (rm -rf /gfs/test-vol/)

Criminology answered 3/8, 2016 at 11:3 Comment(3)
You first have to do: gluster volume stop <volume_name>Schuck
Yes of course, the OP had done both in the snippet they shared.Criminology
My bad, it seems that it is still not enough in 2024 and that you have to manually remove the volume after the delete command.Schuck
G
2

To delete the the data from the back-end you need to remove it manually e.g in your case you need to do rm -rf /gfs/test-vol/

Galarza answered 12/1, 2017 at 6:19 Comment(1)
Fastest will be create empty directory: /home/blanktest and after rsync -a --delete blanktest/ /gfs/test-vol/Rushing
C
2

You can mount the volume at a point for example /mnt/data, then use rm -rf /mnt/data/*. And then remove the volume from gluster.

Camisado answered 19/5, 2017 at 7:4 Comment(0)
E
-1

Disconnect the mount (umount) the dir. and then force remove the volume. Followed by manually delete the contents in the volume recursively to permanently remove the persistent data in the volume.

Everara answered 15/10, 2020 at 5:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.