how to use USB hard disk as /(root)
#1
hi all .

i usually use hard disk as root .
i think   hard disk is more tough than sd card  and the space of it is over 250GB or more .

for example banana pi M1 , root is /dev/sda1


Code:
head /boot/boot.cmd
if ext4load mmc 0 0x00000000 /boot/.verbose
then
setenv verbosity 7
else
setenv verbosity 1
fi
setenv bootargs "console=tty1 root=/dev/sda1 rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=${verbosity}"


but
at pine64's debian  , surely there are files in /boot  but they are binaly files  so i do not do anythig , i give up .
only develover knows how to  , so i think .
regards
  Reply
#2
Look at the /boot/uEnv.txt. You can probably overwrite default root=/dev/mmcblk0p2 to /dev/sda1 by using "extraargs"
http://linux-sunxi.org/UEnv.txt
  Reply
#3
(06-26-2016, 07:31 AM)martinayotte Wrote: Look at the /boot/uEnv.txt. You can probably overwrite default root=/dev/mmcblk0p2 to /dev/sda1 by using "extraargs"
http://linux-sunxi.org/UEnv.txt

thanks for great advice .

but i fail .
something is wrong with me .

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


2)do next shell script
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)rewite  /ma1/etc/fstab

Code:
# UNCONFIGURED FSTAB FOR BASE SYSTEM
# <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/mmcblk0p3  none    swap    sw                        0              0
/dev/sda2  none    swap    sw                        0              0



in order to return SD card only system , i rewrite uEnv.txt originally.
in this   state


Code:
root@pine64pro:/home/debian# mount /dev/sda1 /ma1


root@pine64pro:/home/debian# ls /ma1
bin  boot  dev    etc  home  lib    lost+found  media  mnt    opt  proc  root  run  sbin  srv  sys  tmp  usr    var

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

also fail .

----
regards
  Reply
#4
I gave it a try, and it was working perfectly for me by simply adding "root=/dev/sda1" in uEnv.txt.
In my case, I'm running Ubuntu with longsleep kernel 3.10.101+ built myself, but I've never added any thing for USB storage, longsleep has the proper setting already.
What is your kernel revision ?
What kind of USB storage ?
  Reply
#5
(06-27-2016, 11:14 AM)martinayotte Wrote: I gave it a try, and it was working perfectly for me by simply adding "root=/dev/sda1" in uEnv.txt.
In my case, I'm running Ubuntu with longsleep kernel 3.10.101+ built myself, but I've never added any thing for USB storage, longsleep has the proper setting already.
What is your kernel revision ?
What kind of USB storage ?

hows the performance ?
You can find me on IRC, Discord and Twitter


  Reply
#6
I didn't do any performance tests, especially because I didn't have a real USB-HDD handy, all the ones I have are used somewhere else with precious contents, so I've tested it with a small USB-Dongle, so probably not quite fast.
  Reply
#7
(06-27-2016, 11:14 AM)martinayotte Wrote: I gave it a try, and it was working perfectly for me by simply adding "root=/dev/sda1" in uEnv.txt.
In my case, I'm running Ubuntu with longsleep kernel 3.10.101+ built myself, but I've never added any thing for USB storage, longsleep has the proper setting already.
What is your kernel revision ?
What kind of USB storage ?


i am running pine64-image-debianxfce-310101bsp.img .

and

uname -ar
Linux pine64pro 3.10.101-0-pine64-longsleep #39 SMP PREEMPT Sat May 7 12:39:25 $

and

usb strage is
pine64+:USB-------USB_sata_converter-----sata hardsisk


i chose debian because using ubuntu . the firefox do not run well for me .

---
regards
  Reply
#8
I have no clues, it should work since it worked for me.
Revise your procedures, and hook up an USB-TTL on Debug port to figure out any other errors, like I did : on first boot, I forgot to create an empty /proc folder on /dev/sda1.
  Reply
#9
i did experiment but this is not root as hard disk drive .

1) sd card only boot

insert USB memory( this is recognaized as sda )

mkdir /SAVE

and
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 4196352 10487807 6291456 3G 5 Extended
/dev/sda5 4198400 4231167 32768 16M 83 Linux
/dev/sda6 4233216 4265983 32768 16M 83 Linux
/dev/sda7 4268032 5316607 1048576 512M 83 Linux
/dev/sda8 5318656 5351423 32768 16M 83 Linux
/dev/sda9 5353472 9547775 4194304 2G 83 Linux

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/sda5 /dev ext4 defaults,noatime 0 1
/dev/sda6 /proc ext4 defaults,noatime 0 1
/dev/sda7 /run ext4 defaults,noatime 0 1
/dev/sda8 /sys ext4 defaults,noatime 0 1
/dev/sda9 /tmp ext4 defaults,noatime 0 1


2) then reboot ( attaching USB memory)
df
ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置
/dev/mmcblk0p2 14326776 3490516 10097960 26% /
devtmpfs 468608 0 468608 0% /dev
tmpfs 502140 68 502072 1% /dev/shm
tmpfs 502140 7112 495028 2% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 502140 0 502140 0% /sys/fs/cgroup
/dev/mmcblk0p1 51082 24242 26840 48% /boot
/dev/sda9 1998672 3112 1874320 1% /tmp
/dev/sda1 2514736 3840 2363440 1% /SAVE
tmpfs 100432 4 100428 1% /run/user/117
tmpfs 100432 8 100424 1% /run/user/1000

free
total used free shared buffers cached
Mem: 1004284 376828 627456 8596 12056 160076
-/+ buffers/cache: 204696 799588
Swap: 2097148 0 2097148


the result tells me
a) swap is OK
b)/SAVE and /tmp only OK .

any way this reduce sd card's burden and sd card has longer life time .
( mkdir /SAVE/d1 ; ln -s /SAVE/d1 /var/www/d1 <-apache2)

---
regards
  Reply
#10
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.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  root running from usb connected ssd locks up system marcelser 0 2,754 11-17-2017, 04:50 PM
Last Post: marcelser
  OMV base on Debian jessie Root Problem ayamy 3 6,233 09-03-2017, 09:21 PM
Last Post: tllim
  resize root partition to max available space SD card can provide bilylilyli 16 22,914 11-18-2016, 07:10 PM
Last Post: pfeerick
  root password shaozhai 4 7,212 08-25-2016, 12:55 PM
Last Post: jl_678
Sad How to resize the root partition in order to fully utilize the SD Card MicroDiery 5 8,365 05-24-2016, 05:48 AM
Last Post: Luke
  Debian root's password? rayivy 2 4,748 05-12-2016, 08:59 PM
Last Post: rayivy
  what is the root password for debian? piahoo 5 11,483 04-29-2016, 02:12 PM
Last Post: rhkean

Forum Jump:


Users browsing this thread: 1 Guest(s)