segunda-feira, 7 de outubro de 2013

Criando partições com Fdisk

Uma das mais conhecidas ferramentas para manipular a tabela de partições no Linux é o Fdisk.

Para listarmos a tabela de partições de um disco use a opção "-l":

# fdisk -l /dev/sda

Disk /dev/sda: 500 GB, 500105249280 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       12158    97659103   83  Linux
Warning: Partition 1 does not end on cylinder boundary.
/dev/sda2           12158       36473   195310237   83  Linux
Warning: Partition 2 does not end on cylinder boundary.
/dev/sda3           36473       60801   195414660    f  Extended LBA
/dev/sda5           36473       60801   195414660   83  Linux
Warning: Partition 5 does not end on cylinder boundary.
#


Aqui temos um disco de 500Gb com 2 partições primárias (1 e 2), uma extendida (3) e uma lógica (5).

Para alteramos as partições, podemos chamar o Ddisk passando como parâmetro o disco (no nosso exemplo, /dev/sda).

# fdisk /dev/sda
GNU Fdisk 1.2.4
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

Using /dev/sda
Command (m for help):


Para ajuda, tecle "m".

Command (m for help): m
Command action
   a   toggle bootable flag
   b   edit bsd disklabel
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help):  


O Fdisk pode assustar no início, mas ele tem opções bem interessantes, e sua ajuda realmente nos ajuda. Por exemplo, para listar as partições, tecle "p".

Command (m for help): p                                                  

Disk /dev/sda: 500 GB, 500105249280 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       12158    97659103   83  Linux
Warning: Partition 1 does not end on cylinder boundary.                  
/dev/sda2           12158       36473   195310237   83  Linux
Warning: Partition 2 does not end on cylinder boundary.                  
/dev/sda3           36473       60801   195414660    f  Extended LBA
/dev/sda5           36473       60801   195414660   83  Linux
Warning: Partition 5 does not end on cylinder boundary.                  
Command (m for help):                                                    


Use "n" para criar uma nova partição, "d" para excluir, "p" para listar as partições, "l" para listar os tipos de partições que o Fdisk conhece, "w" para gravar as mudanças e "q" para sair.


Nenhum comentário:

Postar um comentário