Skip to main content
added 70 characters in body
Source Link
StrongBad
  • 5.5k
  • 12
  • 52
  • 78

My root file system is on a btrfs partition. My /chroot directory has a number of btrfs subvolumes in it which prevent me from deleting it with rm -rf /chroot. In an attempt to delete all the subvolumes, I tried listing just the subvolumes below /chroot by using the -o, which the man page says "print only subvolumes below specified path".

# btrfs subvolume list -o /chroot
ID 593 gen 6616 top level 5 path chroot/base-devel/root
ID 594 gen 6618 top level 5 path chroot/multilib-devel/root
ID 595 gen 6620 top level 5 path chroot/base/root
ID 597 gen 6624 top level 5 path chroot/twm/root
ID 599 gen 6628 top level 5 path chroot/lxde/root
ID 601 gen 6655 top level 5 path chroot/wheezy/root
ID 602 gen 6684 top level 5 path chroot/sid/root
ID 603 gen 6862 top level 5 path var/lib/machines

To my surprise, this returns the subvolume in /var/lib/macines (which I do not want to delete). This leads me to 3 questions:

  1. What does the -o option do?

  2. How do I list only subvolumes below /chroot

  3. How can I delete a directory with an unknown number of subvolumes?

I am running Arch Linux with the 4.2.5 kernel and btrfs-progs v4.3.1

My root file system is on a btrfs partition. My /chroot directory has a number of btrfs subvolumes in it which prevent me from deleting it with rm -rf /chroot. In an attempt to delete all the subvolumes, I tried listing just the subvolumes below /chroot by using the -o, which the man page says "print only subvolumes below specified path".

# btrfs subvolume list -o /chroot
ID 593 gen 6616 top level 5 path chroot/base-devel/root
ID 594 gen 6618 top level 5 path chroot/multilib-devel/root
ID 595 gen 6620 top level 5 path chroot/base/root
ID 597 gen 6624 top level 5 path chroot/twm/root
ID 599 gen 6628 top level 5 path chroot/lxde/root
ID 601 gen 6655 top level 5 path chroot/wheezy/root
ID 602 gen 6684 top level 5 path chroot/sid/root
ID 603 gen 6862 top level 5 path var/lib/machines

To my surprise, this returns the subvolume in /var/lib/macines (which I do not want to delete). This leads me to 3 questions:

  1. What does the -o option do?

  2. How do I list only subvolumes below /chroot

  3. How can I delete a directory with an unknown number of subvolumes?

My root file system is on a btrfs partition. My /chroot directory has a number of btrfs subvolumes in it which prevent me from deleting it with rm -rf /chroot. In an attempt to delete all the subvolumes, I tried listing just the subvolumes below /chroot by using the -o, which the man page says "print only subvolumes below specified path".

# btrfs subvolume list -o /chroot
ID 593 gen 6616 top level 5 path chroot/base-devel/root
ID 594 gen 6618 top level 5 path chroot/multilib-devel/root
ID 595 gen 6620 top level 5 path chroot/base/root
ID 597 gen 6624 top level 5 path chroot/twm/root
ID 599 gen 6628 top level 5 path chroot/lxde/root
ID 601 gen 6655 top level 5 path chroot/wheezy/root
ID 602 gen 6684 top level 5 path chroot/sid/root
ID 603 gen 6862 top level 5 path var/lib/machines

To my surprise, this returns the subvolume in /var/lib/macines (which I do not want to delete). This leads me to 3 questions:

  1. What does the -o option do?

  2. How do I list only subvolumes below /chroot

  3. How can I delete a directory with an unknown number of subvolumes?

I am running Arch Linux with the 4.2.5 kernel and btrfs-progs v4.3.1

Tweeted twitter.com/StackUnix/status/655201429423001602
Source Link
StrongBad
  • 5.5k
  • 12
  • 52
  • 78

How to delete a directory with multiple btrfs subvolumes?

My root file system is on a btrfs partition. My /chroot directory has a number of btrfs subvolumes in it which prevent me from deleting it with rm -rf /chroot. In an attempt to delete all the subvolumes, I tried listing just the subvolumes below /chroot by using the -o, which the man page says "print only subvolumes below specified path".

# btrfs subvolume list -o /chroot
ID 593 gen 6616 top level 5 path chroot/base-devel/root
ID 594 gen 6618 top level 5 path chroot/multilib-devel/root
ID 595 gen 6620 top level 5 path chroot/base/root
ID 597 gen 6624 top level 5 path chroot/twm/root
ID 599 gen 6628 top level 5 path chroot/lxde/root
ID 601 gen 6655 top level 5 path chroot/wheezy/root
ID 602 gen 6684 top level 5 path chroot/sid/root
ID 603 gen 6862 top level 5 path var/lib/machines

To my surprise, this returns the subvolume in /var/lib/macines (which I do not want to delete). This leads me to 3 questions:

  1. What does the -o option do?

  2. How do I list only subvolumes below /chroot

  3. How can I delete a directory with an unknown number of subvolumes?