Ubuntu: Neue Festplatte hinzufügen
Wie das geht, hab ich eigentlich schon in den Basics beschrieben, aber doppelt gemoppelt hält besser 😉
Als erstes Festplatte einbauen, danach schauen, ob fdisk die Platter erkennt:
sudo fdisk -l
Ausgabe:
Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf4890fc4
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 20969471 20967424 10G 83 Linux
Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vdc: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vdd: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Nun die Disks mit den bereits gemounteten gegenchecken (df), falls man unsicher ist, welches nun die neue Disk ist. In meinem Fall ist es /dev/vdd.
Partition erstellen:
sudo fdisk /dev/vdd
Nun die gewünschten Befehle eingeben. Gib den Buchstaben m + Enter ein, um eine Liste der verfügbaren Befehle zu erhalten. Mit p kann die aktuelle Partitionstabelle der ausgewählten Festplatte angezeigt werden:
Command (m for help): p
Disk /dev/vdd: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4e6e58f8
Nun also wie folgt Partitionieren:
- n – für neue Partition
- p – für primär
- 1 – für Partition-Nummer (default nehmen)
- 2048 – Erster Sektor (default nehmen)
- 104857599 – Letzter Sektor (default nehmen)
- w – für schreiben und exit
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599):
Created a new partition 1 of type 'Linux' and of size 50 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Nun ist die Partition erstellt:
$ sudo fdisk -l
Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf4890fc4
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 20969471 20967424 10G 83 Linux
Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vdc: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/vdd: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4e6e58f8
Device Boot Start End Sectors Size Id Type
/dev/vdd1 2048 104857599 104855552 50G 83 Linux
Partition formatieren
sudo mkfs.ext4 /dev/vdd1
Partition Mounten
Bei mir gibt es eine Backup Disk und möchte die Disk auf /backup mounten:
sudo mkdir /backup
sudo mount -v -o rw /dev/vdd1 /backup
Jetzt die Partition noch im fstab eintragen, damit sie beim Booten erkannt wird:
sudo vi /etc/fstab
folgende Zeile einfügen:
/dev/vdd1 /backup ext4 defaults 0 0
Nun ist alles eingerichtet, die Platte kann verwendet werden und wird auch nach einem Neustart erkannt.
df
/dev/vdd1 51474044 53064 48783208 1% /backup
.