#34 Issue closed
: parted -s /dev/sda mkpart fails with rear-snapshot-0.0.815¶
Labels: bug
gdha opened issue at 2012-03-29 08:34:¶
Fedora 17 with rear-snapshot-0.0.815 (it used to work last week on a previous version 0.0.794 ):
+++ parted -s /dev/sda set 2 boot on
+++ parted -s /dev/sda name 2 ext4
+++ parted -s /dev/sda mkpart rear-noname 525185024B 5368709119B
Error: You requested a partition from 525MB to 5369MB.
The closest location we can manage is 525MB to 5369MB.
disklayout.conf:
disk /dev/sda 6442450944 gpt
part /dev/sda 1048576 1048576 rear-noname bios_grub /dev/sda1
part /dev/sda 524288000 2097152 ext4 boot /dev/sda2
part /dev/sda 5915017216 526385152 rear-noname lvm /dev/sda3
# disk /dev/sdb 4294967296 gpt
lvmdev /dev/vg /dev/sda3 WIV8Xr-hN1o-JNRn-XMUU-Kl6I-I0tF-ErxYUV 11552768
lvmgrp /dev/vg 32768 176 5767168
lvmvol /dev/vg lv_swap 50 3276800
lvmvol /dev/vg lv_root 126 8257536
fs /dev/mapper/vg-lv_root / ext4 uuid=53faa99e-be97-4a15-80d9-936a0103e33e label= blocksize=4096 reserved_blocks=4% max_mounts=-1 check_interval=0d options=rw,relatime,seclabel,user_xattr,barrier=1,data=ordered
fs /dev/sda2 /boot ext4 uuid=576e6373-50c9-4762-8bbd-95f83931a680 label= blocksize=1024 reserved_blocks=5% max_mounts=-1 check_interval=0d options=rw,relatime,seclabel,user_xattr,barrier=1,data=ordered
swap /dev/mapper/vg-lv_swap uuid=bf30769d-f25b-4dfd-bd2a-cecf4694e02a label=
The source system has the following:
[root@beefy layout]# parted /dev/sda print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 6442MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot
Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 526MB 524MB ext4 ext4 boot
3 526MB 6441MB 5915MB lvm
RESCUE beefy:/var/lib/rear/layout # parted /dev/sda print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32.8kB 892kB 859kB rear-noname bios_grub
2 893kB 525MB 524MB ext4 boot
jhoekx commented at 2012-03-29 08:45:¶
Partition resizing changed slightly last week.
Can you post the output of
# cat /sys/block/sda/size
in the rescue system?
And change the partition end to something slightly smaller and report back the first value that works? It's most likely one or two sectors off.
Another issue I can see is that the bios_grub partition has been resized, that also needs to be fixed.
gdha commented at 2012-03-29 09:11:¶
# cat /sys/block/sda/size
10485760
RESCUE beefy:/var/lib/rear/layout # parted -m /dev/sda print BYT;
/dev/sda:5369MB:scsi:512:512:gpt:VMware, VMware Virtual S:;
1:32.8kB:989kB:956kB::rear-noname:bios_grub;
2:991kB:525MB:524MB:ext4:ext4:boot;
3:525MB:4844MB:4319MB::rear-noname:lvm;
RESCUE beefy:/var/lib/rear/layout # df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 428304 0 428304 0% /dev
tmpfs 453128 0 453128 0% /dev/shm
tmpfs 453128 204 452924 1% /run
tmpfs 453128 0 453128 0% /sys/fs/cgroup
/dev/mapper/vg-lv_root 2549504 772024 1675244 32% /mnt/local
/dev/sda2 508745 46054 437091 10% /mnt/local/boot
I reduced it more, but if you like I can redo the exercise?
jhoekx commented at 2012-03-29 09:40:¶
I tried a resize in VMware from a 6G virtual disk to a 5G virtual disk, as in your case. No problems...
Can you post the output of
# parted -s /dev/sda u b p
Or the sequence below in the rescue system (after code generation):
RESCUE archrear:~ # cat /sys/block/sda/size
10485760
RESCUE archrear:~ # parted -s /dev/sda u b p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 5368709120B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32768B 98703871B 98671104B primary ext2 boot
2 98705408B 5368709119B 5270003712B primary lvm
RESCUE archrear:~ # grep parted /var/lib/rear/layout/diskrestore.sh
parted -s /dev/sda mklabel msdos >&2
parted -s /dev/sda mkpart primary 32768B 98703871B >&2
parted -s /dev/sda set 1 boot on >&2
parted -s /dev/sda mkpart primary 98705408B 5368709119B >&2
parted -s /dev/sda set 2 lvm on >&2
I need to know if it's the end or the start of the partition that's giving problems.
The parted version would also be helpful.
dagwieers commented at 2012-03-29 09:52:¶
Gratien,
If you indent a block (at least 4 characters) the block will be a code listing block (with proportional font etc...) or if you prefer syntax highlighting you can do what Jeroen does by using:
```bash
bash code
```
I have been editing your notes in order to get the output cleaned up, but I hope you could do it yourself in the future ;-)
jhoekx commented at 2012-03-29 11:55:¶
Hypothesis: GPT disks also write a copy of the GPT table at the end of the disk.
The new partition resizing actually works. The previous one left enough space at the end of the disk for this to be unnoticed.
gdha commented at 2012-03-29 12:22:¶
Before started the layout/recreate/default/20_run_script.sh ran I checked the size:
rear> cat /sys/block/sda/size
10485760
And, show the original piece of code of /var/lib/rear/layout/diskrestore.sh (only the parted part):
parted -s /dev/sda mklabel gpt >&2
parted -s /dev/sda mkpart rear-noname 32768B 891402B >&2
parted -s /dev/sda set 1 bios_grub on >&2
parted -s /dev/sda mkpart ext4 892928B 525180927B >&2
parted -s /dev/sda set 2 boot on >&2
parted -s /dev/sda name 2 "ext4"
parted -s /dev/sda mkpart rear-noname 525185024B 5368709119B >&2
parted -s /dev/sda set 3 lvm on >&2
Started the recovery and we got the error back:
+++ parted -s /dev/sda mkpart rear-noname 525185024B 5368709119B
Error: You requested a partition from 525MB to 5369MB.
The closest location we can manage is 525MB to 5369MB.
2012-03-29 13:47:40 An error occured during layout recreation.
Via the shell option have a look at the parted layout:
rear> parted -s /dev/sda u b p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 5368709120B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32768B 891903B 859136B rear-noname bios_grub
2 892928B 525180927B 524288000B ext4 boot
Quickly calculated we the size of the 3th partition should:
5368709120-859136-524288000=4843561984
It seems that in the disklayout.sh code this is almost correct:
part /dev/sda 4843562484 526385152 rear-noname lvm /dev/sda3
Changed it into:
part /dev/sda 4843561984 526385152 rear-noname lvm /dev/sda3
And give it another try. However, in diskrestore.sh the line stayed the same:
parted -s /dev/sda mkpart rear-noname 525185024B 5368709119B >&2
But, still we get the error:
+++ parted -s /dev/sda mkpart rear-noname 525185024B 5368709119B
Error: You requested a partition from 525MB to 5369MB.
Changed the code into
parted -s /dev/sda mkpart rear-noname 525185024B 4843561984B
The partition worked fine, but got an error on lvcreate:
+++ lvm lvcreate -l 126 -n lv_root vg
Volume group "vg" has insufficient free space (78 extents): 126 required.
2012-03-29 14:16:08 An error occured during layout recreation.
But, that is less critical and can be changed easily by the end-user.
jhoekx commented at 2012-03-29 12:30:¶
I can reproduce the error now and will fix it!
jhoekx commented at 2012-03-29 13:22:¶
This should have been fixed by 6eadab229739396f34e9e95d20037e8140c27f2d. Please reopen if it wasn't.
[Export of Github issue for rear/rear.]