LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-31-2012, 06:32 PM   #1
ssenuta
Member
 
Registered: Mar 2006
Location: NYS
Distribution: Mandriva-2006
Posts: 123

Rep: Reputation: 16
Question Help setting up GPT partitions with GNU parted (version 2.3).


I currently us a msdos MBR type partitions on my computer & would like to use "custom" GPT partitions with my next Fedora operating system.
Can someone tell me if the following GNU PARTED patition commands are correct for Disk /dev/sda: 320GB.

parted /dev/sda ..start parted interactively on disk /dev/sda

mklabel gpt ..create an empty GPT partition table on /dev/sda

mkpart primary 0MB 2MB ..create a 2MB primary partition# 1
set 1 bios_grub on ..tell linux partition# 1 will hold the GRUB2 (core.img) stage2 bootcode

mkpart primary 2MB 252MB ..create a 250MB primary partition# 2
set 2 legacy_boot on ..tell special purpose software that the #2 GPT partition may be bootable

mkpart primary 252MB 50.252GB ..create a 50GB primary partition# 3
mkpart primary 50.252GB 52.252GB ..create a 2GB primary partition# 3
mkpart primary 52,252GB 60.252GB ..create a 10GB primary partition# 4

mkpart primary 60.252GB 320.000GB ..partition remaining disk space as primary partition# 5

Here is how I plan to use my GTP partitions:

<PARTITION> <SIZE> <FS-TYPE> <MNT-PT>
GTP partition# 1 2M none none ..grub2 will put its core.img data here
GTP partition# 2 250M ext3 /boot ..grub2 files, grub.cfg & kernel
GTP partition# 3 50G ext4 / ..Fedora rootfs (/usr;/run;/var;/dev; ..etc)
GTP partition# 4 10G ext4 /home ..user(s) personal files
GTP partition# 5 2xxG ext4 /mnt/storage ..misc file storage area mounted only as needed
 
Old 04-05-2012, 09:02 PM   #2
ssenuta
Member
 
Registered: Mar 2006
Location: NYS
Distribution: Mandriva-2006
Posts: 123

Original Poster
Rep: Reputation: 16
Solved MY GPT partitioning questions.

While waiting for a response to my GPT disk partitioning question, I did more research & decided
to alter my Parted commands. The following commands were used & resulted in a GRUB2 bootable GPT
Partition setup for my Fedora-15 Linux system.

parted /dev/sdb ..start parted interactively on disk /dev/sdb

mklabel gpt ..create an empty GPT partition table on /dev/sda (Partition Code: EF02 auto asigned)

mkpart linux ---- 17.4KB 2MB ..create a 1983KB (BIOS BOOT) partition# 1 {1st 17.4KB (34 x 512 =17408 sectors) used by parted for its data}
set 1 bios_grub on ..tell linux partition# 1 will hold the GRUB2 (core.img) stage2 bootcode

mkpart linux ext2 2MB 252MB ..create a 250MB partition# 2
set 2 legacy_boot on ..tell special purpose software that the #2 GPT partition may be bootable
..used by software like syslinux to determine which partition to boot when
in BIOS mode. (Syslinux GPT boot loader for BIOS systems --not supported by Fedora)

mkpart linux ext2 252MB 50252MB ..create a 50GB (50,000,000,000 bytes) partition# 3
mkpart swap linux-swap 50252MB 52252MB ..create a 2GB ( 2,000,000,000 bytes) partition# 4
mkpart linux ext2 52252MB 62252MB ..create a 10GB (10,000,000,000 bytes) partition# 5
mkpart linux ext2 60.252GB 100% ..partition remaining disk space as linux partition# 6
---or---
mkpart linux ext2 60.252GB -1 ..partition remaining disk space as linux partition# 6

Here is a list of the GTP partitions created with the above "Parted" commands:
[root@localhost stan]# parted -l
Model: ATA WDC WD3200AAJS-5 (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags ID MNT-PT
1 17.4kB 2000kB 1983kB linux bios_grub EF02 ----- --grub2 will put its core.img data here
2 2097kB 252MB 250MB ext3 linux legacy_boot 0700 /boot --grub2 files, grub.cfg & kernel
3 252MB 50.3GB 50.0GB ext4 linux 0700 / --Fedora rootfs (/usr;/run;/var;/dev; ..etc)
4 50.3GB 52.3GB 2048MB linux-swap(v1) swap 8300 swap --linux-swap (activated by /etc/fstab entry)
5 52.3GB 62.3GB 10.0GB ext4 linux 0700 /home --user(s) personal files
6 62.3GB 320GB 258GB ext4 linux 0700 /mnt/* --misc file storage area mounted only as needed

NOTE:
* 1.) GPT partitions don't use Primary Extended & Logical partition types (Use name: linux)
2.) Parted asks for FS-Type & only presents ext2 as an option. This is used to set a partition-type ID code in partition table.
(eg.) FS-TYPE ext2 ..set code to 0700 or 8300
FS-TYPE linux-swap ..set code to 8200
FS-TYPE bios_grub --set code to EF02 (AKA: BIOS BOOT partition)
3.) You must create a filesystem on a partition outside of the parted utility before it will be displayed by parted.
* 4.) The command "parted -l" doesn't display partition ID codes. You must use the "gdisk" utility to see ID codes.
5.) Parted commads "set" & disk_set share the same flags
FLAG is one of: boot, root, swap, hidden, raid, lvm, lba, hp-service, palo, prep, msftres, bios_grub, atvrecv, diag, legacy_boot
6.) Parted will alter partition "Start End" entries & compute sensible ranges for the locations you specify. If the calculated values
differ too much, Parted will ask you for confirmation. ...Use the "p" print interactive command after each partition you create
so you can determine the proper Start-End range for your next partition.

Here is what the utility "gdisk" displays:
[root@localhost stan]# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.2

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 625142448 sectors, 298.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E6DBFCBB-349A-435B-BF35-11F59DB70B42
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 625142414
Partitions will be aligned on 8-sector boundaries
Total free space is 844 sectors (422.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 34 3906 1.9 MiB EF02 linux ..34 sectors: 512x34=17408 bytes (17.4KB) Bios Boot partition
2 4096 491519 238.0 MiB 0700 linux
3 491520 98148351 46.6 GiB 0700 linux
4 98148352 102148095 1.9 GiB 8200 swap
5 102148096 121679871 9.3 GiB 0700 linux
6 121679872 625141759 240.1 GiB 0700 linux

I hope this helps others who are interested in a GPT (Globally_Unique_Identifier Partition Table) setup.
 
  


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
Slackware64 Setup does not see gpt partitions created with parted on raid5 Alkisx Slackware 10 10-13-2009 12:59 PM
gpt label in parted, partitions look OK. GrUB not booting 64bit OS on 8th primary digital8doug Linux - Newbie 1 12-31-2008 02:20 PM
gnu parted hyphenage Linux - Software 3 08-17-2003 04:41 PM
GNU parted nakkaya Linux - Software 4 03-10-2003 02:17 PM
GNU parted nic_d Linux - Software 1 06-28-2002 04:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:46 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