Professional Documents
Culture Documents
Contact us
Forums
Home
Linux How-to & Tutorials
Shell Scripts
RSS/Feed
nixCraft
(Fig.01: Diagram illustrating the layout of the GUID Partition Table scheme. Each logical block (LBA) is 512 bytes in size. LBA addresses that are negative indicate position from the end
of the volume, with 1 being the last addressable block. Imaged Credit Wikipedia)
Sample outputs:
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
Output:
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
Sample outputs:
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)
OR
(parted) mkpart primary 0.00TB 3.00TB
Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End
Size
File system Name
Flags
1
0.00TB 3.00TB 3.00TB ext4
primary
Sample outputs:
Information: You may need to update /etc/fstab.
Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter:
# mkfs.ext3 /dev/sdb1
OR
# mkfs.ext4 /dev/sdb1
Sample outputs:
mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183148544 inodes, 732566272 blocks
36628313 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Sample outputs:
Filesystem
/dev/sdc1
tmpfs
udev
tmpfs
Size
16G
1.6G
1.6G
1.6G
/dev/sdb1
3.0T
211M
2.9T
1% /data
Make sure you replace /dev/sdb1 with actual RAID or Disk name or Block Ethernet device such as /dev/etherd/e0.0. Do not forget to update /etc/fstab, if
necessary. Also note that booting from a GPT volume requires support in your BIOS / firmware. This is not supported on non-EFI platforms. I suggest you boot
server from another disk such as IDE / SATA / SSD disk and store data on /data.
Further readings:
How Basic Disks and Volumes Work (little outdated but good to understand basic concept)
GUID Partition Table from the Wikipedia
man pages parted
Updated for accuracy!
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!
Featured Articles:
30 Cool Open Source Software I Discovered in 2013
30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
Top 30 Nmap Command Examples For Sys/Network Admins
25 PHP Security Best Practices For Sys Admins
20 Linux System Monitoring Tools Every SysAdmin Should Know
20 Linux Server Hardening Security Tips
Linux: 20 Iptables Examples For New SysAdmins
Top 20 OpenSSH Server Best Security Practices
Top 20 Nginx WebServer Best Security Practices
20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
15 Greatest Open Source Terminal Applications Of 2012
My 10 UNIX Command Line Mistakes
Top 10 Open Source Web-Based Project Management Software
Top 5 Email Client For Linux, Mac OS X, and Windows Users
The Novice Guide To Buying A Linux Laptop
I could create on 3TB volume following guide above. But when rebooting, the pratition tabled is wrong. Pleas Help /T
Reply
7 svrmarty November 11, 2008 at 2:28 pm
when im booting my own build debian kernel,
it stocks when the system wants to mount to root filesystem.
it says somthing like
the following disks found
0800 sd sda
0810 sd sdb
Reply
8 svrmarty November 12, 2008 at 12:07 pm
the error is
VFS: cannot open root device sda2 or unknown-block(8,2)
Please append a correct root= boot option; here are the available partitions:
0800 244129792 sda driver: sd
0810 9765519360 sdb driver: sd
Reply
9 Jamie November 20, 2008 at 11:30 pm
All supported releases of Ubuntu (ie 6.06 LTS and higher) do have CONFIG_EFI_PARTITION=y compiled into the kernel.
Reply
10 Randall January 8, 2009 at 3:07 pm
Since recent versions of Ubuntu and Debian have CONFIG_EFI_PARTITION compiled into their stock kernels, you should remove the part about
having to recompile the kernel so that readers dont needlessly recompile their kernels.
Reply
11 Luke January 28, 2009 at 6:42 am
What tripped me up is mkpart gpt is actually a lone command followed by a sub-command.
Dont type them both at once, wait for the next prompt before typing gpt.
Reply
12 John June 9, 2009 at 2:28 pm
With EXT3 on most systems the max block size is 4096 bytes, which will still limit you to ~8TB for your filesystem.
Reply
13 Manish Patel June 27, 2009 at 4:56 am
Hi,
How to Create a Partition Size Larger than 2TB in Freebsd 7.2 64-bit and 32-bit OS. I have a hardware raid 5 disk contains total 8TB of size and want to
create a partition like one 5TB and one 3TB.
How I can get it done in FreeBsd.
Thank you
Manish
Reply
14 what? December 20, 2009 at 8:45 am
i dont understand the premise.
since i cant buy a > 2tb drive, i dont see the problem.
fdisk /dev/sda
(make a partition of type fd, that spans the entire 2tb drive)
fdisk /dev/sdb
ditto sdc
ditto sdd
mdadm (assemble sda through sdd into a raid 5 of size 6 terabytes)
then mkfs /dev/md0
show me where with the biggest drives you can buy as of today, that youll have to run fdisk against something larger then 2tb????
Reply
* Note: I first tried using gparted but something with the data types in the graphical interface didnt like the size of the raid array and was displaying
negative values. Stupid gui.
Reply
18 Chad Farmer July 18, 2011 at 9:29 pm
Just for people who get search hits on this pageI suggest the commands:
parted /dev/sda
mklabel gpt
mkpart primary 0 -0
print
quit
mkfs.ext3 /dev/sda1
SassyZ needs to understand that file systems are created within partitions while GPT are applied to disks. In other words, parted mklabel gpt
/dev/sda writes a partition table to the first few sectors of a disk drive. The mkpart command creates a partition entry in that GPT. The first
partition is named /dev/sda1. So the mistake in the last command is specifying the wrong device special file name. The command should be
mkfs.ext3 /dev/sda1 to create a file system in the first partition. The command mkfs.ext3 will create a file system starting at sector zero and
overwrite the GPT. (Note Ive never tried a size of -0, so use print to verify the partition that was created.)
Reply
19 Jon Kiji January 19, 2010 at 11:33 am
[quote]show me where with the biggest drives you can buy as of today, that youll have to run fdisk against something larger then 2tb????[/quote]
Try a hardware RAID for a change. The RAID controller will report a single huge drive to your OS. I just skip partitioning the RAID device altogether.
*shrug*. Just mkfs /dev/sdb.
No fiddling with exotic partitions. Not the prettiest of solutions, but very reliable nontheless.
Reply
20 Chris February 9, 2010 at 1:10 am
This isnt working for me.
(parted) mklabel
New disk label type? gpt
Error: Invalid argument during write on /dev/sdb
Retry/Ignore/Cancel?
Would this have anything to do with it
Warning: Device /dev/sdb has a logical sector size of 4096. Not all parts of
GNU Parted support this at the moment, and the working code is HIGHLY
EXPERIMENTAL.
If so, how can I get around this? Im using four 2TB drives in RAID5 volume size is 5.9TB it is ISCSI.
Reply
21 Chris February 9, 2010 at 1:22 am
[QUOTE]I just skip partitioning the RAID device altogether. *shrug*. Just mkfs /dev/sdb[/QUOTE]
I tried that but if I run fdisk -l i get.
Awesome! Thanks for this, after tweaking fdisk settings for ages i came accross your article. Sorted :D
Reply
29 Adrian Schmid February 22, 2011 at 4:36 pm
I used parted as described to work with large arrays, so I am quite happy with it. One question though. What would be the easiest way to copy partition
tables between disks (not partitions!). I know in fdisk there was a tool called sfdisk that let you dump / rewrite partition tables from one disk to another.
is there a similar procedure in parted? any hints greatly appreciated! Adrian
Reply
30 Chad Farmer July 18, 2011 at 9:53 pm
GPT stands for GUID Partition Table. This mean that each partition is assigned a unique ID when the partition is created. So, copying the partition
table is a BAD IDEA, even if you know to also copy the backup partition table at the end of the disk. You should run parted (or whatever) on each
disk that needs the same partition table and create a new partition table with the same partition types and sizes, but with new (unique) GUID
values.
Although not well documented, parted will accept starting location and size in sectors, if values in MB are being rounded and causing slightly
different values than desired. To repartition the fourth disk sdd (and lose all of its content):
parted -s /dev/sdd mkpart fat16 34s 1048609s
Note that Im worried about duplicating the GUID that uniquely identifies each partition, not the standardized GUID value that identifies the
partition type.
Reply
31 Jord Wegge February 26, 2011 at 4:16 pm
Great Tut as always.
One question though All this assumes youve got a running system to which you plan to add a second >2TB device. When using GPT, most modern
linux distros will do as you described.
However, how do you install to such a device?
Situation = 8x2TB raid6 (hardware), and boot-able debian 6.0 cd -> The installer recognizes a 500 GB disk (I previously GPTed the device &
partitioned it to my liking with gparted livecd).
Suggestions?
TIA,
Jord.
Reply
32 Jord Wegge March 11, 2011 at 7:36 pm
Solution for my original problem: ubuntu install cd (in my case 10.10) will only create GPT when the drive is large enough to require it, otherwise
it will stick to msdos mbr.
So: make youre raid as you wish it to be and install straight from cd.
One smaller problem Im facing now is also GPT-related:
I installed ubuntu on 3x2TB hw raid whilst there still was a 5X2TB soft raid in the same machine. Next I moved the data from the soft raid to the
hw raid and expanded the hw raid to its full 8x2TB in raid 6.
When now I want to enlarge /dev/sda3 (ext4) to full raid size I get blocked of by the GPT backup table <>
But I dont quite see how to do that.
Regards,
Jord
Reply
33 Jord Wegge March 11, 2011 at 7:38 pm
quote missing in previous reply:
The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is
smaller. Fix, by moving the backup to the end (and removing the old backup)?
Reply
34 perrysong May 16, 2011 at 1:49 am
Useful
Thanks a lot
Reply
35 Jeff May 26, 2011 at 5:01 pm
If you get this
Warning: The resulting partition is not properly aligned for best performance.
Will start the partition at the correct sector boundary, and the warning no loner appears. More info.
Reply
37 edson August 24, 2013 at 12:36 pm
Thank you.
Finally it works!!
Ubuntu 12.10
Reply
38 Sean S August 11, 2011 at 11:46 pm
I running problem on this. I try to mount a 4*2T RAID5 array with USB connect to NAS IOMEGA IX2-200, the IX2-200 is running Debian Lenny.
How could I know if GPT is enabled?
I applied mklabel gpt successfully, but I still see my RAID5 as 2T disk.
Reply
39 KIRAN September 10, 2011 at 3:09 pm
how to create a mount point of 20 TB LUN in RHEL 5.4 32 bit?
Reply
40 Tokynet September 11, 2011 at 10:04 am
When you get ready to format your new huge partition, I recommend using -m0 with the mkfs command. This will give you the maximum amount of
space to use.
The -m sets the reserved block to zero (0).
If you do not add that to the command, you will loose (i think) either 5 or 10% of the drive to reserved blocks.
# mkfs.ext3 -m0 /dev/sda1
Reply
41 nixCraft September 19, 2011 at 12:13 pm
@All,
Ive updated the tutorial with step by step instructions.
Reply
42 Sean October 9, 2011 at 11:49 pm
Im getting the same errors from Parted as mentioned by Chris above
Warning: Device /dev/sdd has a logical sector size of 4096. and Error: Invalid argument during write on /dev/sdd Retry/Ignore/Cancel? At which
point only Cancel does anything.
In my case the drive is a Hitachi XL3000 3TB (external USB 2.0) and I wanted to format it ext3. Since Parted didnt work for me, I partitioned it under
OS X (Disk Utility) as a single 3TB partition. And then mkfs.ext3 and tune2fs -L for the label. Seems to be working now, but if someone smarter than
me wanted to explain how to do it without resorting to OS X, that would be awesome.
Any help?
Reply
43 Nick October 15, 2011 at 5:33 pm
Sean,
I seem to have just purchased the same drive you are talking about, and yes I had the same problem. I ended it up there by making an error in following
the instructions above. If you look at the drive, you will notice two partitions on it. Both zero in size. Use rm command for each partition and go carefully
back to the beginning.
Note, though, that the above instructions result with some empty space at the beginning of the drive. If you select units as Bytes, the empty space will be
moved to the end of the drive.
Reply
44 Sean October 15, 2011 at 9:55 pm
Hi Nick,
Thanks for the reply. While in Parted, I still cant get anywhere because the disks label remains unrecognized, and the mklabel command simply returns
the above-mentioned error (pretty much every command in Parted returns the same error: unrecognised disk label). Should I be using a different Linux
tool to look at the drive?
Reply
45 DMC November 10, 2011 at 4:22 pm
>Gadgetman October 16, 2008
>I could create on 3TB volume following guide above. But when rebooting, the pratition tabled is wrong. Pleas Help /T
Ive just found the cause of this problem.
http://www.linuxquestions.org/questions/showthread.php?p=4519659#post4519659
Maybe reply #9 explains the reason.
Could anyone tell me whether this issue has already resolved or not.
DMC
Reply
46 Stefan Lasiewski January 4, 2012 at 9:59 pm
Now the other question, how long will it take to fsck one of these 3TB filesystem? This could take many hours. Weve seen it take over 12 hours for a
large filesystem.
By default the OS will automatically fsck the filesystem every 25 mounts or 180 days, whichever comes first. This could be a serious issue if you want
to reboot the system 180 days from now, as your 4 minute reboot could turn into a 4+ hour wait for fsck to complete.
If you want to disable the automatic fsck upon boot, try this command:
# tune2fs -c 0 /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
Reply
53 Andy May 9, 2012 at 6:12 pm
Typo:
(parted) mkpart primary 0 0
should be
(parted) mkpart primary 0 3
And Ubuntu appears to support GPT now (May 2012)
Reply
54 yuria May 29, 2012 at 6:24 am
Hi Master,
i have problem when i create new partition:
Use the mkfs.ext3
#mkfs.ext3 /dev/mapper/mpath0
/dev/mapper/mpath0 is apparently in use by the system; will not make a filesystem here!
Ive been working on this issue for almost day and I cant figure out how to format these partition.
Reply
55 Ha May 29, 2012 at 10:33 am
Hello,
How can I type those commands in the OS install beginning?
My problem: 2.4Tb Raid5 with oracle Linux 5 U6
the error message with GPT dont allow me to do NEXT when I tried to format a layout :(
Too BAD.
Reply
56 Pete June 1, 2012 at 9:43 am
Hi,
If I got a 20TB device /dev/sdb & I creat a 16TB parition /dev/sdb1
How do I create a second partition with the remaining space using parted?
Reply
57 nixCraft June 1, 2012 at 10:45 am
@Pete,
You can use the same command to create a partition:
mkpart primary 0.00TB 16.00TB
mkpart primary 16.00TB 20.00TB
print
You can do it interactively too. Just type mkpat and it will ask you various questions as follows:
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext4
Start? 16TB
End? 20TB
(parted) print free
Reply
58 Victor November 20, 2012 at 11:39 am
Yeah, I should prbboaly wipe it clean and start over I just dont feel like reinstalling everything. There was a time when reinstalling windows felt exciting
a new beginning, and all that shit. Now it just feels like work.I think Im gonna get one of those external USB drives. I saw dell selling 270 GB LaCie for
$100 yesterday which seemed like a decent deal. Then I can back up both drives nightly (80G + 160G). a0|a0
Reply
59 Mudassir November 22, 2012 at 9:36 am
Many thanks
Reply
60 Bart November 25, 2012 at 12:06 am
correction to the step which shows the command (parted) mkpart primary 0 0
Submit
Tagged as: centos gpt partition, config efi partition, efi parititons, error, extensible firmware interface, fdisk 2tb, fdisk command, fdisk partition in centos,
gparted command, GPT, gpt partition, how to make 3 tb partition in linux, how to parted linux command over 2 tb, Linux, linux gpt, linux large partition size,
mkfs ext3 2tb systems, parted command, partition size, partition table, raid 5 array, table de partition > 2tb
Previous post: How to: Migrate Linux Printer Configuration to Another System
Next post: Happy Diwali
nixCraft
Seguir
+1
+ 13 842
Related Posts
Vmware Linux Guest Add a New Hard Disk Without Rebooting Guest
CentOS 4 / Redhat Enterprise Linux 4 iSCSI Installation and Configuration ( iscsi initiators )
Follow
7h
8h
13 Apr
12 Apr
12 Apr
Tweet to @nixcraft
nixCraft
Gosto
43.472 pessoas gostam de nixCraft.
Subscribe to nixCraft
Learn something new about Linux/Unix by email
Enter your email address:
Subscribe
2004-2014 nixCraft. All rights reserved. Privacy Policy - Terms of Service - Questions or Comments - We are proudly powered by Linux + Nginx +
WordPress.
The content is copyrighted to nixCraft and may not be reproduced on other websites.