Free space before and AFTER partitions
by trafikpolisen from LinuxQuestions.org on (#6FXER)
Hi! I've made a nice little script to partition and encrypt drives. For the partitioning, I'm using parted to write a GPT partition table and to create a partition. This is my partitioning command: Code:parted -s /dev/sdX mklabel gpt mkpart "" ext4 1MiB 100%I align the beginning of the partition to 1MiB. However, I've noticed that if I use gparted to create a new partition, gparted also leaves 1 MiB at the END, so I have a few questions.
1. As I understand it, when using GPT, partitioning information is stored at the end of the drive as well (a backup?). If so, when I specify the partition to extend to 100% of available space, I ASSUME the partition itself won't overwrite the GPT area at the end. Is this assumption correct?
2. If I use the command below instead, to leave 1MiB at the end as gparted seems to do by default, will that 1 MiB leave 1 MiB to the end of the drive itself, or 1 MiB to the GPT info at the end? I guess I could ask the question in another way; will the command below create a partition in exactly the same way that gparted does? Code:sudo parted -s /dev/sdX -- mklabel gpt mkpart "" ext4 1MiB -1MiB3. What would be the preferred way? I notice that the partitions on my system drive, which I created with the partitioning tool in the Linux Mint installer, does not leave 1 MiB at the end.
4. Bonus question: Is there a way to make parted output more info when used in my script? Now it's completely silent and I can't find like a "-v" or "--verbose" option in the documentation.
1. As I understand it, when using GPT, partitioning information is stored at the end of the drive as well (a backup?). If so, when I specify the partition to extend to 100% of available space, I ASSUME the partition itself won't overwrite the GPT area at the end. Is this assumption correct?
2. If I use the command below instead, to leave 1MiB at the end as gparted seems to do by default, will that 1 MiB leave 1 MiB to the end of the drive itself, or 1 MiB to the GPT info at the end? I guess I could ask the question in another way; will the command below create a partition in exactly the same way that gparted does? Code:sudo parted -s /dev/sdX -- mklabel gpt mkpart "" ext4 1MiB -1MiB3. What would be the preferred way? I notice that the partitions on my system drive, which I created with the partitioning tool in the Linux Mint installer, does not leave 1 MiB at the end.
4. Bonus question: Is there a way to make parted output more info when used in my script? Now it's completely silent and I can't find like a "-v" or "--verbose" option in the documentation.