LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-27-2023, 05:07 AM   #1
trafikpolisen
Member
 
Registered: Jun 2008
Posts: 121

Rep: Reputation: 3
Free space before and AFTER partitions


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 -1MiB
3. 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.
 
Old 10-27-2023, 10:06 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
1. As far as I know that is correct. The partitioning tools will not overwrite the secondary GPT header.
2. No, the partitioning tools both parted and gparted understand the secondary GPT header, you do not need to do anything special i.e. using 100% will size the partition up to the secondary GPT header.
3. Is your system drive using MBR or GPT? MBR does not need to reserve space at the end. If using GPT then I would guess the Mint installer might hide that information from the user.
4. I don't use parted all that much but I have not seen anything either.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No space to create more partitions, but there is free space anon091 Linux - Newbie 35 10-31-2012 10:46 AM
Help removing free space to create Raw free space nightmare55 Linux - Newbie 11 10-01-2009 03:07 AM
No free space to install but there is free space? HellBound Linux - Laptop and Netbook 6 01-23-2009 09:51 AM
Not enough free space on hard drive with 50g of free space??? auoq SUSE / openSUSE 5 10-13-2004 08:21 PM
Formating free space: WinXP pro and RH9 dualboot with free space on 3rd drive Vermicious Linux - General 2 03-22-2004 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration