- Offizieller Beitrag
Nur ganz schnell um zu erklären was zu tun ist wenn man eine neue Disk hinzugefügt hat um diese dann auch einsetzen zu können. Als erstes mal prüfen ob Sie vom System erkannt wurde:
bei mir im virtuellen Ubuntu 19 kommt da:
root@maria:~# sudo lshw -C disk
*-cdrom
description: DVD reader
product: Virtual CD/ROM
vendor: Msft
physical id: 0.0.0
bus info: scsi@1:0.0.0
logical name: /dev/cdrom
logical name: /dev/dvd
logical name: /dev/sr0
version: 1.0
capabilities: removable audio dvd
configuration: ansiversion=5 status=nodisc
*-disk
description: SCSI Disk
product: Virtual Disk
vendor: Msft
physical id: 0.1.0
bus info: scsi@3:0.1.0
logical name: /dev/sda
version: 1.0
size: 127GiB (136GB)
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096
*-disk
description: SCSI Disk
product: Virtual Disk
vendor: Msft
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sdb
version: 1.0
size: 127GiB (136GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=4096 signature=3b933288
Alles anzeigen
Also eine CD Rom und 2 HDs - alles msft (Microsoft HyperV drives). /dev/sdb scheint schon im Einsatz (partitioned) - kurz prüfen:
root@maria:~# mount | grep /dev/sd
/dev/sdb1 on / type ext4 (rw,relatime,errors=remount-ro)
root@maria:~# df -h | grep /dev/sd
/dev/sdb1 125G 7,7G 111G 7% /
OK also sdb ist als / im EInsatz von sda ist nix zu sehen - also müssen wir diese noch einrichten.
Grafisch findet Ihr unter Utilities eine App Disks:
die liefert hoffentlich das gleiche Ergebnis.
Wir machen jetzt aber mal auf der shell mit fdisk oder gdisk weiter (da universeller)
root@maria:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xe7f9c286.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Alles anzeigen
Da wir eine neue partitiion hinzufügen wollen n und return eintippen. dann p (primary) und 1 für erste partition:
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): 1
First sector (2048-266338303, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-266338303, default 266338303):
Created a new partition 1 of type 'Linux' and of size 127 GiB.
Ihr könnt das natürlich anpassen. Ich nehme hier den einfachsten Fall. Das ganze dann mit w speichern. Im Disktool sieht das dann so aus:
fehlt noch das Dateisystem:
root@maria:~# mkfs -t ext4 /dev/sda1
mke2fs 1.45.3 (14-Jul-2019)
Discarding device blocks: done
Creating filesystem with 33292032 4k blocks and 8323072 inodes
Filesystem UUID: 795d0e8a-772d-4369-a18d-eb6f26ec801e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
Alles anzeigen
Hier sieht man schon, das Teil ist zwar da und formatiert aber nicht gemountet, d.h. von Applikationen so noch nicht nutzbar. Ich möchte die komplette Disk für Datenbanken nutzen und lege deshalb eine mountpoint unter media mit dem Namen dbs an.
root@maria:/# cd media
root@maria:/media# dir
floppy floppy0
root@maria:/media# mkdir /media/dbs
root@maria:/media# dir
dbs floppy floppy0
root@maria:/media# ls -lart
total 16
lrwxrwxrwx 1 root root 7 Dez 25 16:52 floppy -> floppy0
drwxrwxr-x 2 root root 4096 Dez 25 16:52 floppy0
drwxr-xr-x 20 root root 4096 Dez 25 16:55 ..
drwxr-xr-x 2 root root 4096 Dez 28 10:15 dbs
drwxr-xr-x 4 root root 4096 Dez 28 10:15 .
Alles anzeigen
Den potentiellen mountpoint müssen wir dann auch noch einrichten damit er beim Systemstart zu Verfgügung steht.
root@maria:/media# vi /etc/fstab
root@maria:/media# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=fd6d0b72-8b76-48b6-91ca-f7fafa77b5e7 / ext4 errors=remount-ro 0 1
/swapfile none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda1 /media/dbs ext4 defaults 0 2
root@maria:/media# mount -a
Alles anzeigen
Ja und wie sieht das jetzt grafisch aus - here we are:
das ganze funktioniert auch - ein kurzer test:
root@maria:/media# cd dbs
root@maria:/media/dbs# touch test.txt
root@maria:/media/dbs# ls -lart
total 24
drwx------ 2 root root 16384 Dez 28 10:11 lost+found
drwxr-xr-x 4 root root 4096 Dez 28 10:15 ..
-rw-r--r-- 1 root root 0 Dez 28 10:23 test.txt
drwxr-xr-x 3 root root 4096 Dez 28 10:23 .
die Berechtigungen müsst Ihr jetzt natürlich noch so anpassen wie Ihr das braucht.
Anmerkung: sicherer ist es UUID der Platten zu nutzen als das erstemal einfacher erscheinende /dev/sdX. Warum? Plattenreihenfolge etc. kann sich ändern - ist mir hier gerade passiert und /media/dbs war auf einmal gleich / - nicht gut!!
Also besser
UID=795d0e8a-772d-4369-a18d-eb6f26ec801e /media/dbs ext4 defaults 0 2 in die fstab