Debian GNU parted

Posted on

Problem :

I have an internal SATA hard drive which is 4TB. When installing Debian Wheezy, the installer saw it as a 2.2TB drive. I was told to use GNU parted to set up GPT on the partition I wanted, so I set up the initial partitions as follows:
/ – 50GB
swap – 10GB
/raid – 2.14TB ext4 (this is the partition in question)

Running fdisk -l lists the following partitions:
/dev/sda1 (boot)
/dev/sda2 (swap)
/dev/sda3 (presumably the partition for /raid)

I ran parted /dev/sda3 followed by mklabel gpt. The second command gave me an error which read something along the lines of:
“Error: Partition(s) 1, 2, 3, …. , 64 on /dev/sda3 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.”

The above message is produced whenever I execute mkpart as well. Furthermore, when executing mkpart, I can’t seem to specify a size beyond 2.14TB, even if I specify End to be 100%.

So, to sum up: What do I need to do to get my 4TB – 50GB (for /) – 10GB (for swap) = 3.94TB (roughly)?

My kernel version is:
3.2.0-4-686-pae

Solution :

GPT is a partition table for the whole disk, not for a single partition in MBR partition table. So using parted you can do:

parted /dev/sda
mklabel gpt
mkpart ...
mkpart ...
mkpart ...

I know this is an old thread, but still important. In answer to your single disk question. You should boot off of a live cd to run parted. This should allow you to convert the MBR to GPT on the unmounted single disk. Parted does not necessarily wipe out the data on the drive unless you use something like mkfs or change the limits to exclude where the OS is. Some examples can be found at
http://www.thegeekstuff.com/2011/09/parted-command-examples/
Once you have converted the MBR to GPT, you will have to add the partition information. Read about mklabel and rescue at
http://www.gnu.org/software/parted/manual/parted.html

Leave a Reply

Your email address will not be published. Required fields are marked *