Je viens de prendre un disque dur externe car j’ai pas trop confiance dans les cartes SD ( désolé Michel).
Etape 1 : Le formatage, pour cela il faut fdisk !
rock64@rock64:~$ cat /etc/debian_version
9.9
rock64@rock64:~$ sudo whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
rock64@rock64:~$ dpkg -S /sbin/fdisk
util-linux: /sbin/fdisk
rock64@rock64:~$ sudo fdisk -l
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mtdblock0: 4 MiB, 4128768 bytes, 8064 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/mmcblk1: 59.5 GiB, 63864569856 bytes, 124735488 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: gpt
Disk identifier: 9CFDF7D8-766C-43DE-9354-57097D428E8F
Device Start End Sectors Size Type
/dev/mmcblk1p1 64 8063 8000 3.9M Linux filesystem
/dev/mmcblk1p2 8064 8191 128 64K Linux filesystem
/dev/mmcblk1p3 8192 16383 8192 4M Linux filesystem
/dev/mmcblk1p4 16384 24575 8192 4M Linux filesystem
/dev/mmcblk1p5 24576 32767 8192 4M Linux filesystem
/dev/mmcblk1p6 32768 262143 229376 112M Microsoft basic data
/dev/mmcblk1p7 262144 124735454 124473311 59.4G Linux filesystem
Disk /dev/sda: 1.8 TiB, 2000398933504 bytes, 3907029167 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: 0x88185100
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 64 3907024128 3907024065 1.8T 7 HPFS/NTFS/exFAT
rock64@rock64:~$ sudo mkfs.ext3 /dev/sda1
mke2fs 1.43.4 (31-Jan-2017)
/dev/sda1 contains a ntfs file system labelled 'Seagate Portable Drive'
Proceed anyway? (y,N) y
Creating filesystem with 488378008 4k blocks and 122101760 inodes
Filesystem UUID: 42a1cde2-2269-4582-b4a0-2bb6272b0990
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
A noter qu’en cas de crash durant le formatage, je conseille alors :
rock64@rock64:~$ sudo mkfs -t ext4 /dev/sda1
[sudo] password for rock64:
mke2fs 1.43.4 (31-Jan-2017)
Creating filesystem with 488378008 4k blocks and 122101760 inodes
Filesystem UUID: 3e48d36d-20e7-45b8-abea-97a6b234cfcc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information:
Et si la connexion n’est pas stable pendant le formatage :
rock64@rock64:~$ sudo apt-get install screen
...
rock64@rock64:~$ sudo screen -dmS "format" mkfs -t ext4 /dev/sda1
...
Etape 2 : Préparation du montage sur l’OS :
rock64@rock64:~$ sudo mkdir /disk1 rock64@rock64:~$ sudo mount /dev/sda1 /disk1 rock64@rock64:~$ df -H Filesystem Size Used Avail Use% Mounted on udev 2.1G 0 2.1G 0% /dev tmpfs 412M 5.6M 406M 2% /run /dev/mmcblk1p7 63G 41G 20G 68% / tmpfs 2.1G 0 2.1G 0% /dev/shm tmpfs 5.3M 4.1k 5.3M 1% /run/lock tmpfs 2.1G 0 2.1G 0% /sys/fs/cgroup /dev/mmcblk1p6 118M 1.1M 117M 1% /boot/efi tmpfs 412M 0 412M 0% /run/user/1000 /dev/sda1 2.0T 80M 1.9T 1% /disk1
Etape 3 : Modification du fstab :
rock64@rock64:~$ sudo vi /etc/fstab
Etape 3 bis: On peut aussi utiliser les labels:
rock64@rock64:~$ sudo e2label /dev/sda1 nextcloud
rock64@rock64:~$ sudo vi /etc/fstab
rock64@rock64:~$ sudo cat /etc/fstab
LABEL=boot /boot/efi vfat defaults,sync 0 0
LABEL=nextcloud /disk1 ext4 defaults 1 1
ATTENTION, il faut tester le fichier /etc/fstab AVANT le reboot … sinon c’est LA MORT
rock64@rock64:~$ sudo mount -a /etc/fstab
Voir même un petit text de copie :
rock64@rock64:~$ sudo cp -r /var/www/html/nextcloud/ /disk1/.