These instructions explain what to do with a newly inserted mSATA SSD disk or an USB drive which oddly is not partitioned yet.
When the new mSATA SSD has been hardware installed it has no partitions. It has to be done because making a new file system require a partition.
Login with SSH to the router with Putty or from the command line:
$ ssh root@192.168.1.1
A new disk is assigned with a letter and it has to be identified. Do this by communicating directly with the Linux-kernel in /proc directory with grep:
root@turris:~# grep -v ram /proc/partitions major minor #blocks name 31 0 1024 mtdblock0 31 1 7168 mtdblock1 8 0 234431064 sda 179 0 7634944 mmcblk0 179 1 7633920 mmcblk0p1 179 24 4096 mmcblk0rpmb 179 16 4096 mmcblk0boot1 179 8 4096 mmcblk0boot0
Here we see a new disk called sda, and as there is no sda1
it has not been partitioned yet. The disk can also be seen in the /dev directory with the command ls -l /dev/sd?
:
root@turris:~# ls -l /dev/sd? brw-r--r-- 1 root root 8, 0 Nov 27 20:50 /dev/sda
A disk can be partitioned in 4 primary partitions or several extended partitions. Typically 1 partition with one file system is recommended for most use. To partition the disk use the fdisk program and make 1 partition with all the space available. Run the command fdisk /dev/sda
. Press p to print the current partitions. Press n to make a new partition and p for a primary partition. You will be asked about First sector and Last sector with minimum and maximum as default so just press ENTER to those questions. Press w to write the new partition layout. Here is what you will see:
root@turris:~# 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. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x7a924c4c. Command (m for help): p Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 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: 0x7a924c4c 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): First sector (2048-468862127, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-468862127, default 468862127): Created a new partition 1 of type 'Linux' and of size 223.6 GiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
Now the disk has one unformatted partition which can be seen with ls
and grep
:
root@turris:~# ls -l /dev/sd* brw-r--r-- 1 root root 8, 0 Nov 27 20:50 /dev/sda brw-r--r-- 1 root root 8, 1 Nov 27 20:50 /dev/sda1 root@turris:~# grep sda /proc/partitions 8 0 234431064 sda 8 1 234430040 sda1
Now you should make a file system on the new partition.
Alternative to fdisk
you can use the more user-friendly full screen menu driven cfdisk
: