Setup USB drive and SAMBA/NAS on OpenWrt from scratch

[OpenWRT] Setup USB drive and SAMBA/NAS on OpenWrt from scratch

After flashing the TP-LINK 703N router from U-boot failsafe webserver, you are having a brand new router. Software need to be installed to perform certain tasks. In this article, we are talking about setup a NAS using a USB drive from scratch.

By default, Openwrt doesn’t include any USB driver, so the first thing you need to do is to install the USB driver.

First you need to setup 703N in router mode (WAN mode), or AP mode (LAN mode). That makes sure 703N can access the internet. The client (your PC) should connect to 703N via wireless.

Lucky, it’s very easy to install software in Openwrt Luci web page.

Go to System menu, software

Like every Linux system, package list need to be updated before install the software. Press the Update button.

In the web page or SSH, install the following packages:

#Those are USB drivers
kmod-usb-core
kmod-usb2
kmod-usb-storage
kmod-usb-storage-extras
block-mount
kmod-usb-uhci
kmod-usb-ohci

#Those are file system support, you may choose only the ones you are using:
kmod-fs-exfat
kmod-fs-ext4
kmod-fs-ntfs
kmod-fs-vfat

#IO charset, IMPORTANT
kmod-nls-cp437
kmod-nls-iso8859-1

#This one is for auto mount
block-mount

#These are samba server and web page configuration software:
luci-app-samba
luci-i18n-samba-en
samba36-server

To enable the auto mount feature, so that you don’t need to mount the USB device manually each time you plug it in, run the following in SSH:

root@OpenWrt:~# block detect > /etc/config/fstab
root@OpenWrt:~# cat /etc/config/fstab
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

config 'mount'
        option  target  '/mnt/sda1'
        option  uuid    '40e0-6302'
        option  enabled '0'

root@OpenWrt:~# /etc/init.d/fstab enable

Simply plug in a USB drive formatted in FAT, reboot the router and check if USB device is mounted by:

df -h

The USB drive should be here in the list other than a few system partitions.

Then let’s configure samba, there are two config files we need to edit. First, edit /etc/config/samba, this file tells samba where are the share point in the system. Here is my configuration:

config samba
	option 'name'			'openwrt'
	option 'workgroup'		'openwrt'
	option 'description'	        'openwrt'
	option 'homes' 			'1'
		
config sambashare
	option 'name'			'mnt'
	option 'path'			'/mnt/'
	option 'read_only'		'no'
	option 'guest_ok'		'yes'
	option 'create_mask'	        '0700'
	option 'dir_mask'		'0700'
	#option 'users'			'abc'


config sambashare
	option 'name'			'root'
	option 'path'			'/'
	option 'read_only'		'no'
	option 'guest_ok'		'no'
	option 'create_mask'	        '0700'
	option 'dir_mask'		'0700'
	#option 'users'			'abc'

It shares the file system as well as the mount point.

The second file is /etc/samba/smb.conf, this is the standard samba config file. Refer to Samba manual for detail. Here is my smb.conf file:

[global]
        netbios name = |NAME| 
        workgroup = |WORKGROUP|
        server string = |DESCRIPTION|
        syslog = 10
        encrypt passwords = true
        passdb backend = smbpasswd
        obey pam restrictions = yes
        socket options = TCP_NODELAY
        unix charset = utf-8
        preferred master = yes
        os level = 20
        security = user
        guest account = nobody
# For safety, disable root user
#        invalid users = root
        smb passwd file = /etc/samba/smbpasswd

enable samba auto start and reboot the router again:

/etc/init.d/samba enable

Samba should be able to start automatically and can get access to USB immediately after reboot.

Leave a Comment

Jump to comment-10296
cialis tablets

2019-11-04 10:44:09

You really make it seem so easy with your presentation but I find this matter to be really
something that I think I would never understand.
It seems too complicated and extremely broad for me.

I'm looking forward for your next post, I will try to get the hang of it!

Jump to comment-11232
Leon Smith

2019-12-02 22:53:17

I like what you guys tend to be up too. This sort of clever
work and reporting! Keep up the very good works guys I've included you guys
to my personal blogroll.

Jump to comment-13042
sundae marketing

2019-12-08 08:09:02

Do you have a Facebook page? Can I add you?

Jump to comment-21501
Empowered Boost

2020-01-18 21:23:42

Greetings! Very useful advice within this post!

It's the little changes that produce the biggest changes.
Many thanks for sharing!

Jump to comment-21810
fba

2020-02-01 11:12:50

Hmm is anyone else having problems with the
images on this blog loading? I'm trying to figure out if its a problem
on my end or if it's the blog. Any responses would be greatly appreciated.

Jump to comment-21868
Betsy Wilshire

2020-02-08 10:09:28

Are the residents of your Community paying too much....and waiting too long... for their mailbox repairs and mailbox replacements?

Now there is another choice available in your County......ASAP Mailbox And More, Inc.

We work directly with our foundry to fabricate any style of mailbox and post for 100's of HOA's across the country and guarantee the quickest and most affordable LOCAL service in the industry.

To learn more email us at info@asapmailbox.com

PS: If you send us a photo of your existing mailboxes, we will send you back a written quote of our pricing to repair and/or replace your specific mailboxes.

Jump to comment-22107
Keto 360 Slim

2020-02-23 02:56:18

Why users still make use of to read news papers when in this technological
world all is available on web?

Jump to comment-22198
cxsmbmkkwk

2020-02-25 23:30:56

That frightens the stagehand arrangement to here are a infrequent remarkable ED hoofs: Like Epidemiological elk Ms herds or holster presswoman

Jump to comment-22423
advance auto parts richmond ky

2020-03-02 22:06:08

Thank you for the sensible critique. Me and my neighbor were just preparing
to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post.
I'm very glad to see such fantastic info being shared freely out there.

Jump to comment-22647
Sayaka.S11.Xrea.com

2020-03-08 15:59:14

Saved as a favorite, I love your web site!

Jump to comment-23361
bolo no pote

2020-03-14 08:41:55

A verdade é que hoje em dia a gente não pode mais ficar contando com a sorte ou com a ligação
de um emprego perfeito. Eu não sei você, mas eu não consigo dormir bem pensando que tem gente
precisando de uma renda extra e eu guardo os segredos da
oportunidade de negócio a 7 chaves. "Acordando o Prédio", "Eu, Você, o Mar e Ela", "Meteoro" e "Sinais" estão garantidas.

Como por exemplo a Leidiana que assim como eu resolvi fazer com o meu negócio das maçãs gourmet, ela abriu todas as suas receitas,
macetes e técnicas de vendas para o público em geral.

Quando eu pesquisei minha receita para fazer as maçãs gourmet eu joguei muito
material fora até acertar e chegar à perfeição. Um jeito
mais gostoso é fazer uma receita de beijinho para
usar como recheio e uma de brigadeiro para usar como cobertura.
Para montar o bolo de pote de cenoura, simplesmente coloque no potinho camadas alternadas de discos de bolo
e de creme de brigadeiro.

Jump to comment-23459
Jump Manual

2020-03-15 11:56:47

Hey would you mind letting me know which webhost you're utilizing?
I've loaded your blog in 3 completely different internet browsers and I
must say this blog loads a lot quicker then most. Can you recommend a
good internet hosting provider at a honest price?
Many thanks, I appreciate it!

Jump to comment-23681

2020-03-18 06:26:52

Jump to comment-23746
personal bots

2020-03-19 16:29:01

I am truly thankful to the owner of this web page who has shared this
great paragraph at at this time.

Jump to comment-23819
Blonde both ends

2020-03-21 18:04:41

pegging massagehandjob with germanbeautiful ass phuckfotos
de sashagranny mastrbatenaomi public blowjobmale ya lameari yaathe movieNaughte veddick
flashamazingbogas bros sexermosa latina colombianaamateur sybian movielily anal cubalokalisasi dolly surabaya

Jump to comment-23915
orgawsoge

2020-03-25 18:50:42

Jump to comment-23926
Dennisemure

2020-03-26 03:19:48

Jump to comment-23927
boggittee

2020-03-26 03:26:59

Jump to comment-23931
orgawsoge

2020-03-26 09:11:11

Jump to comment-23936
Dennisemure

2020-03-26 18:18:23

Jump to comment-23938
boggittee

2020-03-26 20:21:20

Jump to comment-23942
orgawsoge

2020-03-26 23:40:10

Jump to comment-23947
Dennisemure

2020-03-27 08:50:13

Jump to comment-23951
orgawsoge

2020-03-27 14:25:40

Jump to comment-23957
Dennisemure

2020-03-27 23:39:51

Jump to comment-23959
orgawsoge

2020-03-28 04:58:12

Jump to comment-23960
boggittee

2020-03-28 05:35:59

Jump to comment-23967
Dennisemure

2020-03-28 14:34:54

Jump to comment-23969
orgawsoge

2020-03-28 19:42:55

Jump to comment-23971
boggittee

2020-03-28 22:16:34

Jump to comment-23975
Dennisemure

2020-03-29 05:18:01

Jump to comment-23996
cialis online

2020-03-30 19:55:24

Thanks , I have recently been searching for info about this subject
for a long time and yours is the greatest I've discovered so far.
However, what about the bottom line? Are you sure about
the supply?

Jump to comment-29784
cialis generic

2020-11-25 12:09:07

I constantly spent my half an hour to read this website's posts all the time along with a cup of coffee.

Jump to comment-31271
Buy Antimizol online

2020-12-27 20:10:52

Heya i am for the primary time here. I found this board and I find
It really useful & it helped me out much. I hope to
present one thing back and help others like you aided me.

Jump to comment-32265
Pablo Grier

2021-03-15 20:11:30

Hello

YOU NEED QUALITY VISITORS FOR YOUR: geektalks.org ?

WE PROVIDE HIGH-QUALITY VISITORS WITH:
- 100% safe for your site
- real visitors with unique IPs. No bots, proxies, or datacenters
- visitors from Search Engine (by keyword)
- visitors from Social Media Sites (referrals)
- visitors from any country you want (USA/UK/CA/EU…)
- very low bounce rate
- very long visit duration
- multiple pages visited
- tractable in google analytics
- custom URL tracking provided
- boost ranking in SERP, SEO, profit from CPM

CLAIM YOUR 24 HOURS FREE TEST HERE=> ventfara@mail.com


Thanks, Pablo Grier

Jump to comment-32469
Latisha Billington

2021-03-26 07:00:41

Hello

YOU NEED HELP TO BUILD SEO LINKS FOR: geektalks.org ?

I just checked out your website, and wanted to find out if you need help for SEO Link Building ?

WE OFFER YOU THE BEST SEO STRATEGY FOR 2021.

Build an unlimited number of Backlinks and increase Traffic to your websites which will lead to a higher number of customers and much more sales for you.

If You Are Interested, I'm waiting for your response here => seosubmitter@mail.com


Thanks, Latisha Billington

Jump to comment-32561
cheap nfl football jerseys

2021-03-31 21:40:15

Hi there, just became aware of your blog through Google, postcheap nike nfl jerseysand found that it's truly informative cheap nfl jerseys. I gonna watch out for brussels. I will be grateful if you continue this in future. Lots of people will be benefited from your writing. Cheers!

Jump to comment-32573
Bennett Beazley

2021-04-01 11:21:54

Hello

YOU NEED QUALITY VISITORS FOR YOUR: geektalks.org ?

WE PROVIDE HIGH-QUALITY VISITORS WITH:
- 100% safe for your site
- real visitors with unique IPs. No bots, proxies, or datacenters
- visitors from Search Engine (by keyword)
- visitors from Social Media Sites (referrals)
- visitors from any country you want (USA/UK/CA/EU…)
- very low bounce rate
- very long visit duration
- multiple pages visited
- tractable in google analytics
- custom URL tracking provided
- boost ranking in SERP, SEO, profit from CPM

CLAIM YOUR 24 HOURS FREE TEST HERE=> ventfara@mail.com


Thanks, Bennett Beazley

Jump to comment-32602
generic cytoxan

2021-04-02 11:37:29

Does your blog have a contact page? I'm having problems locating it but, I'd like to send you
an email. I've got some ideas for your blog
you might be interested in hearing. Either
way, great website and I look forward to seeing it develop over time.

Jump to comment-32945
sex portale erotyczne

2021-04-17 11:43:07

Every weekend i used to visit this web page, as i
want enjoyment, as this this site conations really nice funny stuff
too.

Jump to comment-33012
spotkania sex

2021-04-21 08:39:23

What's up, this weekend is nice for me, as this moment
i am reading this impressive educational paragraph here at my
residence.

Jump to comment-33097
seks portale

2021-04-25 16:54:35

An impressive share! I've just forwarded this onto a coworker who was conducting a little homework on this.
And he actually bought me dinner due to the fact that I found it for him...

lol. So let me reword this.... Thanks for the meal!!
But yeah, thanx for spending some time to talk about this
topic here on your web page.

Jump to comment-34068
where to find cheap nfl jerseys

2021-05-21 08:06:56

I have been exploring for a little bit for any high quality articles or blog posts on this sort of area postcheap nfl jerseys china. Exploring in Yahoo I at last stumbled upon this web site. Reading this information So i am happy to convey that I've an incredibly good uncanny feeling I discovered exactly what I needed. I most certainly will make sure to do not forget this web site and give it a glance regularly.

Jump to comment-34135
Columbus Sticht

2021-05-23 07:03:10

Hello geektalks.org

BUY CERTIFIED PROTECTIVE MASKS & MASK CHAINS

BRINE MED CARE offers TOP quality at attractive prices, we deliver to companies and private customers.
Visit our website:
- www.brineshop.ch for Switzerland
- www.brineshop.de for Europe

Companies can request a special offer at med@brine.ch

The .BRINE team looks forward to hearing from you
Thanks, Columbus Sticht
If you no longer wish to hear from us, please reply me.

Jump to comment-36468
Clark Mairinger

2021-07-16 05:57:27

Hello

YOU NEED QUALITY VISITORS FOR YOUR: geektalks.org ?

We Provide Website Traffic 100% safe for your site, from Search Engines or Social Media Sites from any country you want.
With this traffic, you can boost ranking in SERP, SEO, profit from CPM

CLAIM YOUR 24 HOURS FREE TEST HERE=> ventfara@mail.com

Thanks, Clark Mairinger

This post is created on June 03, 2015 and last updated on October 13, 2019