After connecting a new external 5TB hard drive and formatting it as ext4 with parted and mkfs with the procedure below, I then mounted the drive, copied files onto it, unmounted the drive and restarted its host computer (running Ubuntu 18.04.3 LTS). Upon mounting the drive again, the files were no longer on the drive. What am I doing wrong?
Got drive information using lshw:
# sudo lshw -C disk *-disk description: ATA Disk product: ST2000LM015-2E81 vendor: Seagate physical id: 0.0.0 bus info: scsi@2:0.0.0 logical name: /dev/sda version: SDM1 serial: ZDZ5H230 size: 1863GiB (2TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=2f8a9ef2-85cf-49fe-8cf6- 04d7caae1a08 logicalsectorsize=512 sectorsize=4096 *-disk description: SCSI Disk product: Portable vendor: Seagate physical id: 0.0.0 bus info: scsi@3:0.0.0 logical name: /dev/sdb version: 9300 serial: NAA5C9V7 size: 4657GiB (5TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=6 guid=bea19262-56ed-43c1-a4cd- 62bca45eeb62 logicalsectorsize=512 sectorsize=4096Implemented ext4 file system using parted:
# sudo parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? Yes (parted) unit TB (parted) mkpart Partition name? []? 5tb File system type? [ext2]? ext4 Start? 0 End? 5 (parted) print Model: Seagate Portable (scsi) Disk /dev/sdb: 5.00TB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 0.00TB 5.00TB 5.00TB ext4 5tb (parted) quit Information: You may need to update /etc/fstab.Make or Build a Linux File System (use mkfs)
# sudo mkfs -t ext4 /dev/sdb1 mke2fs 1.44.1 (24-Mar-2018) /dev/sdb1 alignment is offset by 512 bytes. This may result in very poor performance, (re)-partitioning suggested. Creating filesystem with 1220933433 4k blocks and 152616960 inodes Filesystem UUID: e29ea500-1588-4128-9e12-b2f62891b318 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: doneManually mounted/unmount the Hard Drive using mount:
Create a mount point: # sudo mkdir /media/5tb Manually mount the drive (not automatic at boot) # sudo mount /dev/sdb1 /media/5tb Unmount the drive # sudo umount /media/5tb
EXTENDED Sep 11, 2019:
Upon reboot, it appears the drives are "reversed" (ie the 5TB drive is now /dev/sda and the 2TB drive is now /dev/sdb):
root@nuc3:/media/5tb# sudo lshw -C disk
*-disk
description: SCSI Disk
product: Portable
vendor: Seagate
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 9300
serial: NAA5C9V7
size: 4657GiB (5TB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=6 guid=657182bf-8953-4001-b0d0-4b81832b17e6 logicalsectorsize=512 sectorsize=4096
*-disk
description: ATA Disk
product: ST2000LM015-2E81
vendor: Seagate
physical id: 0.0.0
bus info: scsi@3:0.0.0
logical name: /dev/sdb
version: SDM1
serial: ZDZ5H230
size: 1863GiB (2TB)
capabilities: gpt-1.00 partitioned partitioned:gpt
configuration: ansiversion=5 guid=2f8a9ef2-85cf-49fe-8cf6-04d7caae1a08 logicalsectorsize=512 sectorsize=4096
@jos, I applied the fdisk to both drives:
# sudo fdisk -l /dev/sda Disk /dev/sda: 4.6 TiB, 5000981077504 bytes, 9767541167 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 Disklabel type: gpt Disk identifier: 657182BF-8953-4001-B0D0-4B81832B17E6 Device Start End Sectors Size Type /dev/sda1 65535 9767533004 9767467470 4.6T Linux filesystem Partition 1 does not start on physical sector boundary.
# sudo fdisk -l /dev/sdb Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 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 Disklabel type: gpt Disk identifier: 2F8A9EF2-85CF-49FE-8CF6-04D7CAAE1A08 Device Start End Sectors Size Type /dev/sdb1 2048 1050623 1048576 512M EFI System /dev/sdb2 1050624 3907026943 3905976320 1.8T Linux filesystem