Add hard drive into Linux Mint 21.1 Vera/Ubuntu/Debian
This is a condensed version on how to add hard disk into Linux Mint/Ubuntu/Debian. First check hard drives in the system, like so:
It should show (partial data only) like this:
*-disk:1
description: ATA Disk
product: WDC WD3200AAKX-0
vendor: Western Digital
physical id: 1
bus info: scsi@1:0.0.0
logical name: /dev/sdb
version: 1H15
serial: WD-WMC2E0871450
size: 298GiB (320GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=e32ff1f9
Using
parted, let's now configure the harddisk/partition
In
parted prompt, create a new GPT partition table
Change the default unit to GB
Create one partition occupying all the space on the drive
(parted) mkpart primary ext4 0 100%
Check to verify the layout
It should show something like below:
Model: ATA WDC WD3200AAKX-0 (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 0.00GB 320GB 320GB ext4 primary
Save and quit
parted
Format the partition using
ext4
$: sudo mkfs -t ext4 /dev/sdb1
Formatting process should show something like below:
mke2fs 1.46.5 (30-Dec-2021)
/dev/sdb1 contains a ext4 file system labelled 'VMs'
last mounted on /mnt/b41faa95-6135-47f6-a24e-ed1909d6fc18 on Sun Dec 25 19:06:43 2022
Proceed anyway? (y,N) y
Creating filesystem with 78142464 4k blocks and 19537920 inodes
Filesystem UUID: 1b7f46da-9aa6-4c30-afec-d983f35a19d5
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks):
done
Writing superblocks and filesystem accounting information: done
Now let us create a mount point
$: sudo mkdir /mnt/vmdisk
Add an entry in fstab to automount the new partition
Add a line entry in fstab like below
/dev/sdb1 /mnt/vmdisk ext4 defaults 0 0
We should be able to use the partition without rebooting, so mount it manually for now.
$: sudo mount /mnt/vmdisk
Add directory to be writable by user
$: sudo mkdir /mnt/vmdisk/vms
Make the user named
timus owner of the new folder
$: sudo chown -R timus:timus /mnt/vmdisk/vms
Refs:
https://help.ubuntu.com/community/InstallingANewHardDrive