Dans cet exemple on va tester l'installation d'un disque dur USB d'1To
On va commencer par brancher le disque usb (sans ça, ça risque d'être dur ...)
On va lister les disques présents :
ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA -> ../../sda
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL -> ../../sdb
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA -> ../../sda
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL -> ../../sdb
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 2009-01-20 14:54 usb-WDC_WD10_EACS-00D6B1_WDC_WD10EA_WD-WCAU44797296 -> ../../sdc
On peut voir qu'on a :
- 1 disque sata de 250Go en sda :
scsi-SATA_ST3250820AS_9QE5RRNA -> ../../sda
Il contient 3 partitions : sda1, sda2, sda3
- 1 disque sata de 500Go en sdb :
scsi-SATA_ST3500320AS_9QM5GSDL -> ../../sdb
Il contient 3 partitions : sdb1, sdb2, sdb3
- 1 disque usb de 1To en sdc :
usb-WDC_WD10_EACS-00D6B1_WDC_WD10EA_WD-WCAU44797296 -> ../../sdc
On a donc trouvé notre nouveau disque usb 1 To !!!
Mais il ne contient pas encore de partitions
On lance l'utilitaire
cfdisk sur
/dev/sdc :
cfdisk /dev/sdc
Un utilitaire graphique s'ouvre :
cfdisk 2.12r
Disk Drive: /dev/sdc
Size: 1000204886016 bytes, 1000.2 GB
Heads: 255 Sectors per Track: 63 Cylinders: 121601
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------
Pri/Log Free Space 1000202,28
[ Help ] [ New ] [ Print ] [ Quit ] [ Units ] [ Write ]
Nous allons créer une partition primaire de la taille maximale du disque dur.
Dans les menus en bas on fait :
[new] puis
[Primary]
On indique la taille de la partition en MB
Pour l'exemple je laisse la taille indiqué qui est la taille maximum :
Size (in MB): 1000202,27
Puis je fini en écrivant la partition en choisissant : [Write] puis yes
Le système indique :
Writing partition table to disk...
Une fois terminé on a :
cfdisk 2.12r
Disk Drive: /dev/sdc
Size: 1000204886016 bytes, 1000.2 GB
Heads: 255 Sectors per Track: 63 Cylinders: 121601
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------
sdc1 Primary Linux 1000202,28
[ Help ] [ New ] [ Print ] [ Quit ] [ Units ] [ Write ]
On quitte :
[Quit]
On peut maintenant formater notre partition en jfs par exemple :
mkfs.jfs /dev/sdc1
Cela nous donne :
mkfs.jfs version 1.1.11, 05-Jun-2006
Warning! All data on device /dev/sdc1 will be lost!
Continue? (Y/N) y
\
Format completed successfully.
976760001 kilobytes total disk space.
Un petit
ls qui va bien pour vérifier :
ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA -> ../../sda
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3250820AS-9QE5RRNA-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL -> ../../sdb
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 ata-ST3500320AS-9QM5GSDL-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA -> ../../sda
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3250820AS_9QE5RRNA-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL -> ../../sdb
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 2009-01-06 13:13 scsi-SATA_ST3500320AS_9QM5GSDL-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 2009-01-20 14:54 usb-WDC_WD10_EACS-00D6B1_WDC_WD10EA_WD-WCAU44797296 -> ../../sdc
lrwxrwxrwx 1 root root 10 2009-01-20 15:26 usb-WDC_WD10_EACS-00D6B1_WDC_WD10EA_WD-WCAU44797296-part1 -> ../../sdc1
On créé un dossier pour le monter :
mkdir /mnt/usb
On le monte dans /mnt/usb :
mount -t jfs /dev/sdc1 /mnt/usb
On peut voir nos partitions :
df -h
Sys. de fich. Tail. Occ. Disp. %Occ. Monté sur
...
/dev/sdc1 932G 117M 932G 1% /mnt/usb
...
On peut y copier un fichier pour tester :
cp /var/log/syslog /mnt/usb
On le démonte :
umount /dev/sdc1
Il arrive parfois qu'on ait une erreur au montage du disque dur :
mount -t jfs /dev/sdc1 /mnt/usb
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
On utilise cette commande qui fait une vérification de la partition
fsck.jfs -fp /dev/sdc1