Skip to content

main/postmarketos-mkinitfs: resize_root_partition: resize dm-* devices

Administrator requested to merge 1546-fix into master

The initramfs tries to re-partition /dev/system_a or /dev/system_b if the rootfs is flashed to a dynamic partition. It uses blkid to find the node name and appends /dev/ by itself. Luckily, there are dm-* devices in the same directory, with the same device node number as the /dev/mapper devices:

/ # partition=$(find_root_partition)
/ # blkid $partition
/dev/mapper/system_b2: LABEL="pmOS_root" UUID="38437aad-a5e4-4fca-af33-b96af9b5bb0c" TYPE="ext4"
/ # echo "${partition##"/dev/mapper/"*}"

/ # dmsetup deps -o devname $partition
1 dependencies  : (system_b)
/ # dmsetup deps -o blkdevname $partition
1 dependencies  : (dm-4)
/ # stat /dev/system_b
stat: can't stat '/dev/system_b': No such file or directory
/ # stat /dev/dm-4
  File: /dev/dm-4
  Size: 0               Blocks: 0          IO Block: 4096   block special file
Device: 1h/1d   Inode: 14550       Links: 1     Device type: fd,4
Access: (0660/brw-rw----)  Uid: (    0/ UNKNOWN)   Gid: (    0/ UNKNOWN)
Access: 1970-01-26 04:53:33.373391697 +0000
Modify: 1970-01-26 04:43:49.006666816 +0000
Change: 1970-01-26 04:43:49.006666816 +0000
/ # stat /dev/mapper/system_b
  File: /dev/mapper/system_b
  Size: 0               Blocks: 0          IO Block: 4096   block special file
Device: 1h/1d   Inode: 14554       Links: 1     Device type: fd,4
Access: (0600/brw-------)  Uid: (    0/ UNKNOWN)   Gid: (    0/ UNKNOWN)
Access: 1970-01-26 04:53:33.490058375 +0000
Modify: 1970-01-26 04:43:49.010000150 +0000
Change: 1970-01-26 04:43:49.010000150 +0000
/ # stat /dev/mapper/system_b2
  File: /dev/mapper/system_b2
  Size: 0               Blocks: 0          IO Block: 4096   block special file
Device: 1h/1d   Inode: 16154       Links: 1     Device type: fd,9
Access: (0660/brw-rw----)  Uid: (    0/ UNKNOWN)   Gid: (    0/ UNKNOWN)
Access: 1970-01-26 04:53:41.890059212 +0000
Modify: 1970-01-26 04:43:50.053333587 +0000
Change: 1970-01-26 04:43:50.053333587 +0000

Closes #1546 (closed)

Merge request reports

Loading