internal M-SATA M.2 SSD WDC_WDS120G1G0B that has running:
4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux and
internal SATA-0 HDD STDR2000100/ST2000LM007 to store multimedia on it.
I have formated HDD's before with gnome-disk-utility/gparted, but never from shell.
What I like to do is, create symlink to home dir /home/hts so
TVHeadEnd can record directly to SATA-0 HDD instead to SSD and the content of the SATA-0 Drive be available to miniDLNA.
At the moment the SATA-0 HDD has default NTFS file system, with msdos partition table,
the M-SATA SSD has gpt partition table with the usual 1=fat32,boot,esp 2=ext4, 3=linux-swap(v1)
Later on I would like to add 6x Seagate 4TB Portable External USB 3.0 STDR4000100 to store
on each "specific" files symlinked to directories:
/home/user/Video
/home/user/Video.Hi-Def
/home/user/Video.FAMILY
/home/user/Pictures.FAMILY
/home/user/Audio
/home/user/Audio.Hi-Res
So if I can get one liner to achieve the below that would be great:
So my question is, in order to get the SATA-0 HDD STDR2000100/ST2000LM007 to be be symlinked to /home/hts
I first need:
-unmount the drive
-delete the current "ntfs" file system and
-then delete partition table "msdos" and
-create "gpt" on the HDD and then
-create filesystem "ext4"
-format the partition with "ext4"?
I have done the following:
Checked if it is not mounted
Code: Select all
$ sudo blkid -o list
device fs_type label mount point UUID
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/dev/sda1 ntfs Seagate Backup Plus Drive (not mounted)
Code: Select all
$ sudo parted /dev/sda print free
Model: ATA ST2000LM007-1R81 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 2000GB 2000GB primary ntfs boot
2000GB 2000GB 512B Free Space
Code: Select all
$ sudo parted /dev/sda mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Information: You may need to update /etc/fstab.
Code: Select all
[code]$ sudo parted /dev/sda rm 1
Information: You may need to update /etc/fstab.
Code: Select all
$ sudo parted /dev/sda print
Model: ATA ST2000LM007-1R81 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
Code: Select all
$ sudo parted -a optimal /dev/sda mkpart primary 0% 100%
Information: You may need to update /etc/fstab.
And end up with this:
Code: Select all
$ sudo parted /dev/sda print
Model: ATA ST2000LM007-1R81 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2000GB 2000GB ntfs primary
So I have then changed to msdos partition table and format it in one command, but that did not work:
Code: Select all
$ sudo parted /dev/sda mklabel msdos mkpart primary ext4 0% 100%
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: mkpart
Yes/No? Yes
Information: You may need to update /etc/fstab.
Than decided to use "fdisk" in desperation:
Code: Select all
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): F
Unpartitioned space /dev/sda: 0 B, 0 bytes, 0 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
Command (m for help): p
Disk /dev/sda: 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: dos
Disk identifier: 0x2d70aec4
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 3907028991 3907026944 1.8T 83 Linux
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): p
Disk /dev/sda: 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: dos
Disk identifier: 0x2d70aec4
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): 0
Value out of range.
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): 4
Value out of range.
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-3907029167, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167):
Created a new partition 1 of type 'Linux' and of size 1.8 TiB.
Partition #1 contains a ntfs 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): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
But not sure what to do now ...