26.12.2014 Views

Gentoo Linux AMD64 Handbook

Gentoo Linux AMD64 Handbook

Gentoo Linux AMD64 Handbook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Preparing the Disks<br />

Example 4.13. An example partition configuration shown by parted<br />

(parted) print<br />

Model: SCSI Block Device<br />

Disk /dev/sda: 21.5GB<br />

Sector size (logical/physical): 512B/512B<br />

Partition Table: msdos<br />

Number Start End Size Type File system Flags<br />

1 512B 2148MB 2148MB primary ext4<br />

2 2148MB 3222MB 1074MB primary linux-swap(v1)<br />

3 3222MB 21.5GB 18.3GB primary lvm<br />

Optional: Setting the GPT Label<br />

Most disks on x86/amd64 are prepared using an msdos label. However, if you plan on creating huge<br />

partitions (2 TB and more), you must use a gpt label (the GUID Partition Type) for your disk. Using<br />

parted, this can be accomplished with mklabel gpt:<br />

Warning<br />

Changing the partition type will remove all partitions from your disk. All data on the disk<br />

will be lost.<br />

Example 4.14. Setting the GPT label<br />

(parted) mklabel gpt<br />

Removing all Partitions<br />

If this isn't done yet (for instance through the mklabel operation earlier, or because the disk is a freshly<br />

formatted one), we will first remove all existing partitions from the disk. Type rm where<br />

is the partition you want to remove.<br />

Example 4.15. Removing a partition from the disk<br />

(parted) rm 2<br />

Do the same for all other partitions that you don't need. However, make sure you do not make any<br />

mistakes here - parted executes the changes immediate (unlike fdisk which stages them, allowing a<br />

user to "undo" his changes before saving or exiting fdisk).<br />

Creating the Partitions<br />

Now let's create the partitions we mentioned earlier. Creating partitions with parted isn't very difficult<br />

- all we need to do is inform parted about the following settings:<br />

• The partition type to use. This usually is primary in case you are not going to have more than 4<br />

partitions (with the msdos partition label). Otherwise, you will need to make your fourth partition<br />

an extended one which hosts the rest of the disk, and create logical partitions inside it. If you use a<br />

gpt-labeled partition, then there is no limit on the number of primary partitions.<br />

• The file system type to use. The parted application supports most common file systems and knows<br />

which kind of partition ID it needs to use for these partitions. This does not mean that parted will<br />

create a file system on the partition (you can with the mkpartfs command, but we'll use the regular<br />

28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!