R
R
root092019-07-12 14:52:32
linux
root09, 2019-07-12 14:52:32

How to deal with two hard drives in nginx?

There is a VPS with two hard drives, this is what fdisk -l displays

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: HGST HUS724020AL
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: gpt
Disk identifier: 65AB4C9A-AD69-4E04-9C2A-D61ADD385D52

Device          Start        End    Sectors    Size Type
/dev/sda1          40       2048       2009 1004.5K BIOS boot
/dev/sda2        4096 3905976319 3905972224    1.8T Linux RAID
/dev/sda3  3905976320 3907022847    1046528    511M Linux swap
/dev/sda4  3907026944 3907028991       2048      1M Linux filesystem


Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: HGST HUS724020AL
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: gpt
Disk identifier: D910C5D0-5C8C-4442-A753-453B034D9223

Device          Start        End    Sectors    Size Type
/dev/sdb1          40       2048       2009 1004.5K BIOS boot
/dev/sdb2        4096 3905976319 3905972224    1.8T Linux RAID
/dev/sdb3  3905976320 3907022847    1046528    511M Linux swap


Disk /dev/md127: 1.8 TiB, 1999857713152 bytes, 3905972096 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

Images are stored on this server and served via nginx, but how to use the second disk when the first one runs out of space?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2019-07-12
@sergiks

If this was just a question about nginx, then there is a try_files directive that tries to find the requested file in different places. Something like:

location / {
  try_files
    /disk_0/images/$uri
    /disk_1/images/$uri
    404;
}

K
ky0, 2019-07-12
@ky0

how to use the second disk when the first one runs out of space?

Merge them into LVM, for example.

P
pfg21, 2019-07-13
@pfg21

merge two file systems via aufs
all contents of % directory 1% and % directory 2% are merged and displayed in % assembly %
files with identical emnip paths will be displayed only from directory 1
when writing, the file will be written to the directory in which there is a specified path and there is free space (the selection principle can be configured)
read man aufs - a lot of functionality that requires careful study ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question