Full Disk Administration Tool for FreeBSD
Student: BraulioRivas (brauliorivas@FreeBSD.org)
Mentor: RobertClausecker (fuz@FreeBSD.com), Alfonso Siciliano (asiciliano@FreeBSD.com)
Project description
FreeBSD currently lacks a tool to operate extensively over partitions and file systems, similar to GParted in Linux. The most similar tool is sade (partedit on bsdinstall), a TUI tool. However, it only allows creating, deleting, and resizing a partition. Plus, it only supports UFS, ZFS, and FAT 12, 16, and 32 filesystems.
The proposed project aims to utilize sade as a starting point to develop a new tool called geomman. The list of features to be added is:
- Allow creating other types of filesystems like ext2, 3, 4, exFAT, and NTFS.
- Resize partitions with a UFS, NTFS, or ext filesystem on it.
- Copy/paste and move partitions.
- Labeling and encrypting a partition using the geli and glabel classes from GEOM.
- Creating an advanced menu exclusively for ZFS, to create new ZFS pools, add a vdev, add a disk, or replace a disk on already created pools.
The goal of the project is to add geomman to the FreeBSD base system, so users can immediately start using this tool to manage partitions and filesystems, like GParted does for Linux.
Approach to solving the problem
Partitions dialog
Develop a new dialog that graphically shows the space occupied by other partitions, so users can use the keyboard to move around the copied partition, or the partition to be moved, rather than using start/end sections, which are inconvenient to use. The new dialog will be added to bsddialog because it is used by geomman.
Shrinking a filesystem/partition
It is necessary that first, the filesystem is shrunk, to then resize the partition itself. However, geomman's allows users to apply their changes temporarily while using it. Therefore, shrinking the filesystem is not possible because the partition has already been resized. In this case, the partition needs to be temporarily resized to its original size, to shrink the filesystem, and then reset the partition to its new shrunken size.
Moving a partition
When moving a partition to an overlapping section, and there is not enough space to back up the whole filesystem, the partition needs to be copied into chunks. dd will be used to move a partition chunk by chunk using offsets.
Deliverables
- New filesystem/partition operations.
- Create an NTFS, exFAT, and EXT2, 3, 4 filesystem.
- Copy/paste a partition.
- Move a partition.
- Grow a UFS, NTFS, and FAT filesystem.
- Shrink an NTFS and FAT filesystem.
- Encryption and labeling using the GEOM framework.
- Encrypt a partition using geli class.
- Label a partition using glabel.
- Exclusive ZFS menu
- Create a pool.
- Adding or removing a vdev from a pool.
- Handling disk attaching, replacing, and removal from a vdev.
Milestones
- June 2nd - June 8th: Week 1
- Familiarize with the sade codebase.
- Extract sade out of the FreeBSD tree.
- June 9th - June 15th: Week 2
- Develop a new menu to manage ZFS file systems.
- List ZFS pools with their configuration for users.
- June 16th - June 22nd: Week 3
- Allow the creation of a ZFS pool.
- Set up pools using stripe, mirror, and RAID vdevs.
- June 23rd - June 29th: Week 4
- Create datasets in a ZFS pool.
- Create a new file system.
- List and mount file systems.
- June 30th - July 6th: Week 5
- Allow a UFS filesystem to grow.
- Enable moving or copying a UFS filesystem.
- Add integrity check option.
- Label a UFS partition.
- July 7th - July 13th: Week 6
- Check FAT file system integrity.
- Move or copy a FAT16, 32 file system.
- July 14th - July 20th: Week 7
- Support creating an exFAT file system.
- Check and label exFAT file systems.
- Move or copy exFAT file systems.
Mid-term Evaluations
- July 21st - July 27th: Week 8
- Perform create, move, copy, check, and label actions on NTFS file systems.
- July 28th - August 3rd: Week 9
- Perform create, grow, shrink, move, copy, check, and label actions on ext2, ext3, and ext4.
- August 4th - August 10th: Week 10
- Develop a new menu to manage GEOM consumers and providers.
- List all geoms.
- Apply labels using glabel.
- August 11th - August 17th: Week 11
- Encryption of geoms with geli.
- August 18th - August 24th: Week 12
- Use this week as a buffer to complete delayed deliverables.
- Prepare the codebase for integration into the FreeBSD base system.
- Add missing tests.
What was done
The project took a different approach, adding features compared to the proposed way. Filesystem operations were added one by one, but each time, for all the supported filesystems. The list of new features is the following:
- Copy and paste partitions in the same or across disks.
- Grow UFS, NTFS, ext2, ext3 and ext 4 filesystems.
- Shrink NTFS, ext2, ext3 and ext 4 filesystem.
- New partitions dialog, where users can visually select a free space to place the partition to be pasted or moved.
- Create exFAT, NTFS, ext2, ext3 and ext 4 filesystems.
- Check all the filesystems: fsck_ufs (UFS), fsck_msdos (FAT), fsck.exfat (exFAT), ntfsfix (NTFS), and e2fsck (ext).
Then, two GEOM-related features were added.
- Creating and labeling a partition: The label is created after the partition, but before the filesystem, because it adds some metadata at the end of the partition.
- Creating and encrypting a partition: As well as labeling, it's created after the partition. (geli) Encryption works by adding an optional "keyfile", plus a "passphrase". geomman allows combining labeling and encryption so that a partition may be labeled and encrypted.
What is missing
- Testing cases.
- None of the ZFS operations were added.
Moving a partition didn't work as expected, because using dd caused the filesystem to get corrupted. It was left for later to carefully think of a better solution.
What we got
Geomman has its official port geomman. The FreeBSD community will be able to install and try the tool. This is a very important step towards incorporating geomman into the FreeBSD base, by letting first users try the tool and receive valuable feedback.
Next steps
Get people to continue installing and using geomman.
- Fix bugs reported by users.
Prepare geomman and open a request to add it into FreeBSD for the nearest release.
- Maintain and improve the tool.
The Code
Repository: https://gitlab.com/brauliorivas/geomman
Useful links
Port: geomman
Join discussion on libera.chat: #freebsd-geomman@libera.chat