General Unix
Attaching an external storage with over 2TB in size
Usually, we can prepare and attach external storage using fdisk and then a permanent entry in fstab. However, when the disk size exceeds 2TB, fdisk will have issues in dealing with this device. You need to install 'parted' in order to prepare the disk. Once parted is installed, launch and use the instructions below to prepare your disk.
- The ‘x’ in /dev/sd
xand ‘xx’ in /dev/sdxxshould be replaced with the suitable device links for your disk. - You can find it out by monitoring
tail -f /var/log/messagesin Raspbian OS. - Using
0 0inmkpartcommand will let you choose all the space available and I selected to use ext4 for the filesystem. - You will replace
.ext4with the suitable extension you select in# mkfs.ext4 /dev/sdxxcommand. - Mount command should be used with ‘xx’ in /dev/sd
xxfor the suitable device and/folderis the path you want to mount this drive to.
parted /dev/sdx
.
.
(parted) mklabel gpt
.
.
(parted) unit TB
.
.
(parted) mkpart primary 0 0
.
.
(parted) quit
.
.
mkfs.ext4 /dev/sdxx
.
.
mount /dev/sdxx /folder
Now that the disk is ready, all you need to is add mount /dev/sdxx /folder to fstab so that it automatically mounts on reboots.