Difference between revisions of "How to View/Partition/Format/Mount HDD/SSD"
Jump to navigation
Jump to search
(Created page with "{{GD Template Impl}} ==How to view the HDD== 1. Check USB device pi@raspberrypi:~ $ lsusb Bus 002 Device 004: ID 152d:0561 JMicron Technology Corp. / JMicron USA Technology...") |
|||
Line 138: | Line 138: | ||
Note: If you need to support partitions larger than 2TB, you need to use the '''parted''' command | Note: If you need to support partitions larger than 2TB, you need to use the '''parted''' command | ||
+ | ==How to format HDD/SSD== | ||
<!--Add review function! --> | <!--Add review function! --> |
Revision as of 20:10, 13 April 2022
How to view the HDD
1. Check USB device
pi@raspberrypi:~ $ lsusb Bus 002 Device 004: ID 152d:0561 JMicron Technology Corp. / JMicron USA Technology Corp. JMS551 - Sharkoon SATA QuickPort Duo Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The first line indicates that the USB device has been correctly recognized by the OS.
2. View HDD/SSD
pi@raspberrypi:~ $ fdisk -l fdisk: cannot open /dev/ram0: Permission denied fdisk: cannot open /dev/ram1: Permission denied fdisk: cannot open /dev/ram2: Permission denied fdisk: cannot open /dev/ram3: Permission denied fdisk: cannot open /dev/ram4: Permission denied fdisk: cannot open /dev/ram5: Permission denied fdisk: cannot open /dev/ram6: Permission denied fdisk: cannot open /dev/ram7: Permission denied fdisk: cannot open /dev/ram8: Permission denied fdisk: cannot open /dev/ram9: Permission denied fdisk: cannot open /dev/ram10: Permission denied fdisk: cannot open /dev/ram11: Permission denied fdisk: cannot open /dev/ram12: Permission denied fdisk: cannot open /dev/ram13: Permission denied fdisk: cannot open /dev/ram14: Permission denied fdisk: cannot open /dev/ram15: Permission denied fdisk: cannot open /dev/mmcblk0: Permission denied fdisk: cannot open /dev/sda: Permission denied fdisk: cannot open /dev/sdb: Permission denied
The last two lines indicate that 2 SSDs devices were found. (sda and sdb)
3. Check if the hard disk is partitioned.
pi@raspberrypi:~ $ sudo fdisk /dev/sda Welcome to fdisk (util-linux 2.36.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors Disk model: Tech Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 33553920 bytes Disklabel type: dos Disk identifier: 0x65b1c901 Device Boot Start End Sectors Size Id Type /dev/sda1 65535 156301487 156235953 74.5G 83 Linux Partition 1 does not start on physical sector boundary. Command (m for help):
The above result tells us that SDA already has a partition: /dev/sda1
pi@raspberrypi:~ $ sudo fdisk /dev/sda Welcome to fdisk (util-linux 2.36.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors Disk model: Tech Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 33553920 bytes Disklabel type: dos Disk identifier: 0x65b1c901 Command (m for help):
The above result tells us that SDA has no partitions
If the hard disk is not partitioned, we need to partition the hard disk
How to Partition a HDD
pi@raspberrypi:~ $ sudo fdisk /dev/sda Welcome to fdisk (util-linux 2.36.1). 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 0xd830672c. Command (m for help): p Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors Disk model: Tech Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 33553920 bytes Disklabel type: dos Disk identifier: 0xd830672c 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 (65535-156301487, default 65535): Last sector, +/-sectors or +/-size{K,M,G,T,P} (65535-156301487, default 156301487): Created a new partition 1 of type 'Linux' and of size 74.5 GiB. Partition #1 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: Y The signature will be removed by a write command. Command (m for help): p Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors Disk model: Tech Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 33553920 bytes Disklabel type: dos Disk identifier: 0xd830672c Device Boot Start End Sectors Size Id Type /dev/sda1 65535 156301487 156235953 74.5G 83 Linux Partition 1 does not start on physical sector boundary. Filesystem/RAID signature on partition 1 will be wiped. Command (m for help): q
Note: If you need to support partitions larger than 2TB, you need to use the parted command
Enable comment auto-refresher
Anonymous user #1
Permalink |
Anonymous user #1
Walker