Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatresize should force user confirmation before performing irreversible and unwanted changes #13

Closed
fragglet opened this issue Jan 14, 2020 · 3 comments

Comments

@fragglet
Copy link

In the following case I wished to resize a 512MiB FAT16 filesystem to a 4GiB one but forgot about the 2GiB limit. This is a log:

# fatresize -s 3700Mi -i /dev/sda1
fatresize 1.0.2 (06/16/18)
FAT: fat16
Size: 512451072
Min size: 489846784
Max size: 4000317440

# fatresize -s 3700Mi /dev/sda1
fatresize 1.0.2 (06/16/18)
Warning: The file system can only be resized to this size by converting to FAT32. 
If you convert to FAT32, and MS Windows is installed on this partition, then you
must re-install the MS Windows boot loader.  If you want to do this, you should
consult the Parted manual (or your distribution's manual).  Also, converting to
FAT32 will make the file system unreadable by MS DOS, MS Windows 95a, and
MS Windows NT.

# fatresize -i /dev/sda1
fatresize 1.0.2 (06/16/18)
FAT: fat32
Size: 3879977472
Min size: 536870912
Max size: 4000317440

fatresize provided a warning but did not ask me to confirm that I wanted to proceed before converting the filesystem to FAT32, which (1) is surprising behavior, (2) is not something I asked the tool to do, (3) left the filesystem in a useless state since this was being used for a DOS machine.

My suggestion is to implement one of the following:

  1. Prompt the user to type the word "yes" to confirm that filesystem conversion is wanted.
  2. Change the warning to an error and force the user to supply a command line argument like "--allow-filesystem-conversion".
@ya-mouse
Copy link
Owner

Ok, I will add the flag. Thanks!

@ya-mouse
Copy link
Owner

ya-mouse commented Apr 5, 2020

The change will be made in the next v1.1.0 release.
The flag will be: -f, --force to not ask questions. Default behavior is to prompt for the choice.

ya-mouse added a commit that referenced this issue Apr 5, 2020
 - drop support for libparted older than 2.4 (#16)
 - introduce `-n, --partition` to set a partition number when
   dealing with file dumps, /dev/loop and /dev/ram devices (#15)
 - ask confirmation for operations (e.g. FAT32 -> FAT16 conversion),
   add `-f, --force` option to not prompt (#13)
 - do not limit FAT32 usage on small partitions (#11)
 - update changelog (#10)
ya-mouse added a commit that referenced this issue Apr 5, 2020
Grand update:
 - drop support for libparted older than 2.4 (#16)
 - introduce `-n, --partition` to set a partition number when
   dealing with file dumps, /dev/loop and /dev/ram devices (#15)
 - ask confirmation for operations (e.g. FAT32 -> FAT16 conversion),
   add `-f, --force` option to not prompt (#13)
 - do not limit FAT32 usage on small partitions (#11)
 - update changelog (#10)
@ya-mouse ya-mouse closed this as completed Apr 5, 2020
@fragglet
Copy link
Author

fragglet commented Apr 5, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants