PROGETTARE IL PARTIZIONAMENTO DEI DISCHI 4° PARTE

()

Per creare o manipolare una partizione, sono previsti vari comandi.

Per conoscere tutti i comandi disponibilii digitiamo fdisk seguito dal device a cui siamo interessati, es /dev/sdb

Apparirà un prompt con la richiesta di inserire un comando

# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).

Command (m for help):

Clicca sul tasto “m” per visualizzare l’help dello strumento fdisk con tutti i comandi disponibili

Command (m for help): m

Command action
a      toggle a bootable flag
b      edit bsd disklabel
c      toggle the dos compatibility flag
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):

Ecco visualizzati tutti i comandi disponibil: fdisk resta nuovamente in attesa che tu scelga un comando tra questi.

Visualizzo la lista delle partizioni di un device

Continuando l’esempio precedente, per visualizzare la tabella delle partizioni del disco /dev/sda utilizziamo il comando “p” (digita “p” sulla tastiera). L’output è identico a quello che avremmo ottenuto con “fdisk -l /dev/sdb”

Command (m for help): p

Disk /dev/sdb: 2483.8 GB, 2483833405440 bytes
255 heads, 63 sectors/track, 301975 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

Device Boot Start End Blocks Id System
/dev/sdb1 1 267350 2147483647+ ee GPT

Command (m for help):

Nuovamente fdisk resta in attesa del prossimo comando.. e così sarà fino a quando non decidiamo di uscire da fdisk utilizzando “q” (quite).

Cancelliamo una partizione

Entriamo nelle fase più delicate di utilizzo di fdisk: la cancellazione di una partizione.

1: Sempre continuando il nostro esempio precedente, utilizziamo il comando “d” (delete).

2: Poco dopo ci verrà chiesto quale partizione eliminare. Abbiamo una sola partizione: sda1,e è quindi la partizione 1. Avessimo avuto più partizioni avremmo ad esempio: sda2 come partizione 2, sda2 come partizione 3…

3: Se voglio eliminare una partizione, digito il numero della partizione: nel nostro esempio è molto semplice: 1 perchè c’è solo una partizione

4: Infine, per salvare la modifica, digitiamo il comando “w” (write).

Command (m for help): d
Partition number (1-4): 1

Command (m for help): w

The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

In questo esempio, come possiamo leggere, il sistema ci avvisa che la cancellazione non è ancora avvenuta perchè il disco è in uso. Verrà cancellata al riavvio della nostra macchina linux.

/ 5
Grazie per aver votato!

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?