Monter et configurer un disque

#ops

J’ai réinstallé Archlinux il y a quelques temps, après 5 ans sous Windows (merci WSL). J’en ferai peut-être un post dédié, mais le sujet qui nous occupe aujourd’hui, c’est mon second disque qui a été perdu dans la bataille.

Bon, essayons déjà de le retrouver.

$ lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat   FAT32       D112-7593                             299,1M     0% /boot/efi
├─sda2 ext4   1.0         f765a0bc-aaa6-4d01-9086-8b7f4825389a  187,6G    15% /
└─sda3 swap   1     swap  b358423b-295d-4c0d-89b3-f07a82f97c59                [SWAP]
sdb
└─sdb1 ntfs         Data  C0D01CB9D01CB79C

On trouve bien sdb1, super.

Essayons de le monter à la main

$ sudo mkdir /mnt/data
$ sudo mount -t ntfs /dev/sdb1 /mnt/data
$ df -h | grep sdb1
/dev/sdb1       541G  351G  191G  65% /mnt/data

Petit check:

$ sudo findmnt --verify --verbose
/mnt/data
   [ ] target exists
   [ ] VFS options: noatime
   [ ] UUID=C0D01CB9D01CB79C translated to /dev/sdb1
   [ ] source /dev/sdb1 exists
   [W] ntfs seems unsupported by the current kernel
   [E] on-disk ntfs seems unsupported by the current kernel

0 parse errors, 1 error, 1 warning

Effectivement, je ne veux pas garder mon disk formaté en ntfs. Une fois certaines données récupérées, je veux le formater en ext4

# umount /dev/sdb1
# mkfs -t ext4 /dev/sdb1
mke2fs 1.47.0 (5-Feb-2023)
/dev/sdb1 contains a ntfs file system labelled 'Data'
Proceed anyway? (y,N) y
Creating filesystem with 141789952 4k blocks and 35454976 inodes
Filesystem UUID: c48208bc-b57b-4c60-bf19-3dd3a8437856
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks):
done
Writing superblocks and filesystem accounting information: done
# lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat   FAT32       D112-7593                             299,1M     0% /boot/efi
├─sda2 ext4   1.0         f765a0bc-aaa6-4d01-9086-8b7f4825389a   75,9G    62% /
└─sda3 swap   1     swap  b358423b-295d-4c0d-89b3-f07a82f97c59                [SWAP]
sdb
└─sdb1 ext4   1.0         c48208bc-b57b-4c60-bf19-3dd3a8437856
# mount -t ext4 /dev/sdb1 /mnt/data
# findmnt --verify --verbose
/boot/efi
   [ ] target exists
   [ ] FS options: umask=0077
   [ ] UUID=D112-7593 translated to /dev/sda1
   [ ] source /dev/sda1 exists
   [ ] FS type is vfat
/
   [ ] target exists
   [ ] VFS options: noatime
   [ ] UUID=f765a0bc-aaa6-4d01-9086-8b7f4825389a translated to /dev/sda2
   [ ] source /dev/sda2 exists
   [ ] FS type is ext4
swap
   [ ] UUID=b358423b-295d-4c0d-89b3-f07a82f97c59 translated to /dev/sda3
   [ ] source /dev/sda3 exists
   [ ] FS type is swap
/tmp
   [ ] target exists
   [ ] VFS options: noatime
   [ ] FS options: mode=1777
   [ ] do not check tmpfs source (pseudo/net)
   [ ] do not check tmpfs FS type (pseudo/net)
/mnt/data
   [ ] target exists
   [ ] VFS options: noatime
   [E] unreachable on boot required source: UUID=C0D01CB9D01CB79C

0 parse errors, 1 error, 0 warnings

Yay !

Editons fstab maintenant. On ajoute

UUID=c48208bc-b57b-4c60-bf19-3dd3a8437856   /mnt/data      ext4    defaults,noatime 0 1

Et vérifions une dernière fois:

# systemctl daemon-reload
# findmnt --verify --verbose
/mnt/data
   [ ] target exists
   [ ] VFS options: noatime
   [ ] UUID=c48208bc-b57b-4c60-bf19-3dd3a8437856 translated to /dev/sdb1
   [ ] source /dev/sdb1 exists
   [ ] FS type is ext4
Success, no errors or warnings detected