@@ -1260,6 +1260,7 @@ int hw_write_fstab(struct hw_destination* dest) {
return -1;
char* uuid = NULL;
+ char mount_options[STRING_SIZE];
// boot
if (*dest->part_boot) {
@@ -1295,7 +1296,16 @@ int hw_write_fstab(struct hw_destination* dest) {
// root
uuid = hw_get_uuid(dest->part_root);
if (uuid) {
- fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1);
+ if(dest->filesystem == HW_FS_BTRFS) {
+ // Loop through the array of known BTRFS subvolumes
+ for ( int i = 0; i < LEN(btrfs_subvolumes); i++ ) {
+ snprintf(mount_options, sizeof(mount_options), "defaults,%s,subvol=%s", BTRFS_MOUNT_OPTIONS, btrfs_subvolumes[i][0]);
+ fprintf(f, FSTAB_FMT, uuid, btrfs_subvolumes[i][1], "btrfs", mount_options, 1, 1);
+ }
+ } else {
+ fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1);
+ }
+
free(uuid);
}