V
V
VA2017-10-03 09:24:25
linux
VA, 2017-10-03 09:24:25

How to mount an additional drive on Ubuntu Server 16.04?

Good afternoon!
There is a server on Ubuntu Server 16.04, added a new hard drive - Disk /dev/sdc: 1.8 TiB
fdisk -l

Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x93162f78

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1          2048   8390655   8388608     4G fd Linux raid autodetect
/dev/sda2       8390656   9439231   1048576   512M fd Linux raid autodetect
/dev/sda3       9439232 468860079 459420848 219.1G fd Linux raid autodetect


Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc8792731

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sdb1          2048   8390655   8388608     4G fd Linux raid autodetect
/dev/sdb2       8390656   9439231   1048576   512M fd Linux raid autodetect
/dev/sdb3       9439232 468860079 459420848 219.1G fd Linux raid autodetect


Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md1: 511.4 MiB, 536281088 bytes, 1047424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md0: 4 GiB, 4290772992 bytes, 8380416 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md2: 219 GiB, 235089231872 bytes, 459158656 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

How to create a partition and move the /var folder there?
Or is it necessary to create a separate folder and mount the partition there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sly_tom_cat ., 2017-10-03
@Ozymandis

Your raid is configured on /dev/sda and /dev/sdb : three partitions on each and in the mirror (most likely) each partition with its own pair on another disk.
/dev/sdc is your new drive.
What and how you use in this raid - you need to look in /etc/fstab.
Everything that is written below is the most general recommendations, do only thoughtfully!
There is no partition table on the new disk - you need to create it through gdisk and create at least one partition:
gdisk / dev / sdc
and there - according to the prompts
Then format the partition
mkfs.ext4 / dev / sdc1
Or you can choose another FS, for XFS for example the command will be mkfs.xfs /dev/sdc1
Then write /etc/fstab your new partition to the /var mount point (if you don't know how - read here:help.ubuntu.ru/wiki/fstab)
After that, you need to transfer all the current content to a new section. To do this:
mount it
mount /dev/sdc1 /mnt
copy
cp -ar /var /mnt
unmount
umount /mnt
After that, check that after the reboot everything was mounted as it should. And when you make sure that everything is OK, you can erase the data from the /var directory. But / dev / sdc1 is already mounted into it.
On a working system, unmount /dev/sdc1, erase everything from the /var directory and mount /dev/sdc1 - it may not work. Then we go to the recovery console and do it from there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question