PINE64
how to use USB hard disk as /(root) - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Linux on Pine A64(+) (https://forum.pine64.org/forumdisplay.php?fid=6)
+---- Forum: Debian (https://forum.pine64.org/forumdisplay.php?fid=24)
+---- Thread: how to use USB hard disk as /(root) (/showthread.php?tid=1520)

Pages: 1 2


RE: how to use USB hard disk as /(root) - hatahata - 06-28-2016

(06-28-2016, 08:23 AM)martinayotte Wrote: Why are you creating so many partitions ?
You should have ONLY a single one with everything inside it, especially true for the /dev, /proc, /run, /srv, /sys and /tmp which must be empty folders inside the rootfs /dev/sda1.
I presume that if you were looking at serial debug port, you would have seen that it stopped and failed trying to mount /proc because it doesn't exist inside your /dev/sda1.

this experiment shows that /tem , /SAVE and swap only  are OK .

 fdisk -l /dev/sda
---------------------------------------------------------------------------------------
Device Boot Start End Sectors Size Id Type
/dev/sda1 10487808 15730687 5242880 2.5G 83 Linux
/dev/sda2 2048 4196351 4194304 2G 82 Linux swap / Solaris
/dev/sda3 


 and 
rewite /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
/dev/sda1 /SAVE ext4 defaults,noatime 0 1
/dev/sda2 none swap sw 0 0
/dev/sda3 /tmp ext4 defaults,noatime 0 1



and
head /etc/apache2/apache2.conf

NameVirtualHost *:80

<VirtualHost *:80>
ServerName s---------------.mydns.jp
DocumentRoot /var/www/d1
</VirtualHost>
----

ln -s /SAVE/d1 /var/www/d1


and more
/proc , /sys and /dev is very small , and /run is small ( in banana pi M1, 580 kB )
the work is left to sd card .

the work /tmp , swap and www is left to hard disk .

namely
sd card's burden becomes less .
i expect sd card gets longer life time .

-----------
regards


RE: how to use USB hard disk as /(root) - martinayotte - 06-28-2016

Why are you still having "/dev/mmcblk0p2 /" and "/dev/sda1 /SAVE" in the /etc/fstab of the /dev/sda1 ?
Is your goal really having the sub drive as a primary root or as a second disk ?


RE: how to use USB hard disk as /(root) - hatahata - 07-01-2016

now
i give up to use hard disk as root , becasue of /boot/uEnv.txt in spite of your kind advice .
so use hard disk as swap , tmp and /SAVE( www files and /home/debian/SAVE folda lives in this folda by ln -s )

anyway

/etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
/dev/sda1 /SAVE ext4    defaults,noatime                0               1    
/dev/sda2 none   swap    sw                             0               0
/dev/sda3 /tmp  ext4    defaults,noatime                0               1

$ df
ファイルシス   1K-ブロック    使用    使用可 使用% マウント位置
/dev/mmcblk0p2    29034620 3522568  24032892   13% /
devtmpfs            468608       0    468608    0% /dev
tmpfs               502140       0    502140    0% /dev/shm
tmpfs               502140    7032    495108    2% /run
tmpfs                 5120       4      5116    1% /run/lock
tmpfs               502140       0    502140    0% /sys/fs/cgroup
/dev/mmcblk0p1       51082   12188     38894   24% /boot
/dev/sda3         10190136   23040   9626424    1% /tmp
/dev/sda1        226815536 2157776 213113076    2% /SAVE
tmpfs               100432       4    100428    1% /run/user/117
tmpfs               100432       0    100432    0% /run/user/1000

top - 03:16:01 up 24 min,  2 users,  load average: 0.66, 0.45, 0.53
Tasks: 115 total,   1 running, 114 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 97.8 id,  2.1 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1004284 total,   984560 used,    19724 free,     6704 buffers
KiB Swap:  3145724 total,        0 used,  3145724 free.   822912 cached Mem

#chown -R debian /SAVE
$ cd /SAVE


Code:
$  sysbench --test=fileio --file-test-mode=seqwr run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Extra file open flags: 0
128 files, 16Mb each
2Gb total file size
Block size 16Kb
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Threads started!
Done.

Operations performed:  0 Read, 131072 Write, 128 Other = 131200 Total
Read 0b  Written 2Gb  Total transferred 2Gb  (14.557Mb/sec)
931.68 Requests/sec executed

Test execution summary:
  total time:                          140.6836s
  total number of events:              131072
  total time taken by event execution: 130.1792
  per-request statistics:
       min:                                  0.05ms
       avg:                                  0.99ms
       max:                               1223.67ms
       approx.  95 percentile:               9.55ms

Threads fairness:
  events (avg/stddev):           131072.0000/0.00
  execution time (avg/stddev):   130.1792/0.00



$ rm test*

when i run sysbench in other than hard disk , the result is
Threads fairness:
events (avg/stddev): 131072.0000/0.00
execution time (avg/stddev): 170.4893/0.00
in spite of using 'read up to 85 MB/s sd card)'


when i want to return it to the beginning(sd card only system ) , i only rewrite /etc/fstab originally .
easy
---
regards

my banana pi M1 has sata interface and sata hard disk and use sata hard disk as root .
(/dev/sda1 236235700 84716984 139518556 38% /)
in this case the result is next
Threads fairness:
events (avg/stddev): 131072.0000/0.00
execution time (avg/stddev): 56.8743/0.00 <---fast 2X


RE: how to use USB hard disk as /(root) - lenny.raposo-pine64.pro - 07-01-2016

just use ext drive for rootfs

BTW I will have rootfs for debian (Mate and Base Headless) available for download in the next couple of hours


RE: how to use USB hard disk as /(root) - hatahata - 07-01-2016

(07-01-2016, 12:30 PM)lenny.raposo-pine64.pro Wrote: available for download in the next couple of hours

thanks .
i am willing to downlod it .

*** now ( several days ago) ***

about ubuntu of pine64
firefox not OK
no chrome

about arch linux of pine64
cannot run firefox

cannot watch URL by chrome


debian is excellent for pine64 users .


RE: how to use USB hard disk as /(root) - hatahata - 07-01-2016

acording to martinayotte's kind advice . i can run root as hard disk drive .

1) rewrite
cat /boot/uEnv.txt
console=tty0 console=ttyS0,115200n8 no_console_suspend
kernel_filename=pine64/Image
initrd_filename=initrd.img
optargs=disp.screen0_output_mode=720p60
ethaddr=36:c9:e3:f1:b8:05
root=/dev/sda1


2)do next script  clone-to-HDD.bat



Code:
ntpd -s
date
echo '--------------------'
mkdir -p /ma1
umount /ma1
mount /dev/sda1 /ma1
df
echo '--------------------'
read X
echo $X
cd /ma1
mkdir -p bin            etc home lib                opt        root       sbin           srv            usr var

for x in /bin          /etc /home /lib               /opt      /root       /sbin         /srv          /usr /var
do
rsync -avHx --delete  $x/  /ma1$x/
done

for x in    boot  dev                  media   mnt       proc         run                      sys  tmp
do
rm -rf /ma1/$x
done

cd /ma1
mkdir -p     boot  dev                  media   mnt       proc         run                     sys  tmp







3) rewrite   /ma1/etc/fstab
# <file system> <dir> <type> <options> <dump> <pass>
/dev/mmcblk0p1 /boot vfat defaults 0 2
#/dev/mmcblk0p2 / ext4 defaults,noatime 0 1

/dev/sda1 / ext4 defaults,noatime 0 1

/dev/sda2 none   swap    sw              0       0


4)reboot

then
df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1      151641080 1943572 141971488   2% /
devtmpfs          468364       0    468364   0% /dev
tmpfs             501916       0    501916   0% /dev/shm
tmpfs             501916    6744    495172   2% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             501916       0    501916   0% /sys/fs/cgroup
/dev/mmcblk0p1     51082   12666     38416  25% /boot
tmpfs             100384       0    100384   0% /run/user/1000



debian@pine64:~$ top
top - 01:04:34 up  1:15,  1 user,  load average: 0.15, 0.11, 0.13
Tasks:  93 total,   1 running,  92 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.1 us,  2.1 sy,  0.0 ni, 95.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1003836 total,   158860 used,   844976 free,     9032 buffers
KiB Swap:  2097148 total,        0 used,  2097148 free.    72516 cached Mem



fdisk -l /dev/sda
Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1       4196352 312581803 308385452 147.1G 83 Linux
/dev/sda2          2048   4196351   4194304     2G 82 Linux swap / Solaris



--------------

if i want to sd card only , i only rewite /boot/ /boot/uEnv.txt .
if i want to hard disk drive as root  , i only rewite /boot/ /boot/uEnv.txt .

thanks !
pine64-image-debianbase-310102bsp.img is great .

now we run pine64  as server Tongue
------------
regards
my home page -> http://pine-akita.blogspot.jp/