Skip to content

Commit 93974fc

Browse files
committed
install: Show size of target partitions for mkfs
We've been seeing `mkfs` sometimes fail in CI, I think this will help debug. Signed-off-by: Colin Walters <[email protected]>
1 parent 01a6fae commit 93974fc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/src/blockdev.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub(crate) struct Device {
2828
pub(crate) label: Option<String>,
2929
pub(crate) fstype: Option<String>,
3030
pub(crate) children: Option<Vec<Device>>,
31+
pub(crate) size: Option<String>,
3132
}
3233

3334
impl Device {
@@ -53,7 +54,7 @@ pub(crate) fn wipefs(dev: &Utf8Path) -> Result<()> {
5354

5455
fn list_impl(dev: Option<&Utf8Path>) -> Result<Vec<Device>> {
5556
let o = Command::new("lsblk")
56-
.args(["-J", "-o", "NAME,SERIAL,MODEL,LABEL,FSTYPE"])
57+
.args(["-J", "-o", "NAME,SERIAL,MODEL,LABEL,FSTYPE,SIZE"])
5758
.args(dev)
5859
.output()?;
5960
if !o.status.success() {

lib/src/install/baseline.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ fn mkfs<'a>(
126126
label: &str,
127127
opts: impl IntoIterator<Item = &'a str>,
128128
) -> Result<uuid::Uuid> {
129+
let devinfo = crate::blockdev::list_dev(dev.into())?;
130+
let size = devinfo.size.as_deref().unwrap_or("(unknown)");
129131
let u = uuid::Uuid::new_v4();
130132
let mut t = Task::new(
131-
&format!("Creating {label} filesystem ({fs})"),
133+
&format!("Creating {label} filesystem ({fs}) on device {dev} (size={size})"),
132134
format!("mkfs.{fs}"),
133135
);
134136
match fs {

0 commit comments

Comments
 (0)