Skip to contentSkip to conversation

BUG :: btrfs resize should require mount point not just /some/path

DISCUSSION Robert White 2 participants 2 messages Nov 18, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

So here's a thing...

If you've got a BTRFS root file system and you mount go to resize a removable media and you make a typo you can easily resize your root instead of a target.

mkdir /media/vol1 /media/vol2
mount /dev/sdz1 /media/vol2 # intended vol1 btrfs resize -32G /media/vol1
umount /dev/sdz1
#proceed to fark up /dev/sdz1 with partitioning tools

Since resize will accept _any_ existing directory (or even filename?) as the target of a resize instead of limiting the targets to known mount-points it pretty much invites mistakes.

The system _should_ error out on any path thats not a mount point in the name of safety alone.

A message like "/some/path not a mounted file system" would be less surprising than operating on a file system when any arbitrary directory is named.

#1 lore raw
Quoted 21 lines

-----Original Message-----
From: [email protected] [mailto:linux-btrfs- [email protected]] On Behalf Of Robert White
Sent: Tuesday, 18 November 2014 9:52 PM
To: Btrfs BTRFS
Subject: BUG :: btrfs resize should require mount point not just /some/path

So here's a thing...

If you've got a BTRFS root file system and you mount go to resize a removable media and you make a typo you can easily resize your root instead of a target.

mkdir /media/vol1 /media/vol2
mount /dev/sdz1 /media/vol2 # intended vol1 btrfs resize -32G /media/vol1 umount /dev/sdz1 #proceed to fark up /dev/sdz1 with partitioning tools

Since resize will accept _any_ existing directory (or even filename?) as the target of a resize instead of limiting the targets to known mount-points it pretty much invites mistakes.

Quoted 6 lines

The system _should_ error out on any path thats not a mount point in the name of safety alone.

A message like "/some/path not a mounted file system" would be less surprising than operating on a file system when any arbitrary directory is named.

I have done the same thing myself, commonly when using scrub, but also using add/del device. It's most alarming!

Paul. ���{.n�+�������+%�����ݶ��w��{.n�+����{���k~���^n�r���z���h����&���z��z�ޗ�+��+zf���h���~����i��������z_��j:+v���)ߣ�m