-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add qubes.ResizeDisk service to adjust filesystem size
Do this using qubes rpc service, instead of calling resize2fs directly by dom0.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
read disk_name | ||
|
||
set -e | ||
|
||
case $disk_name in | ||
private) | ||
# force some read to refresh device size | ||
head /dev/xvdb > /dev/null | ||
resize2fs /dev/xvdb | ||
;; | ||
root) | ||
# force some read to refresh device size | ||
head /dev/xvda > /dev/null | ||
new_size=$(cat /sys/block/xvda/size) | ||
ro=$(/sys/block/xvda/ro) | ||
if [ $ro -eq 1 ]; then | ||
new_table="0 $new_size snapshot /dev/xvda /dev/xvdc2 N 16" | ||
else | ||
new_table="0 $new_size linear /dev/xvda 0" | ||
fi | ||
dmsetup load dmroot --table "$new_table" | ||
dmsetup resume dmroot | ||
resize2fs /dev/mapper/dmroot | ||
;; | ||
*) | ||
echo "Automatic resize of '$disk_name' not supported" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters