How to format USB Memorystick with ext3?

Actually, most of my sticks are either bootable systems or utilities, or if they carry things to exchange, they are usually vfat, since that seems to be the most compatible.

My external HDs have Linux and NTFS partitions, the latter carrying most of the data (such as utilities, installers, reference notes & guides, etc.), since it is far easier to access NTFS from Linux than it is to access Linux partitions from other people’s random Windows machines.

[INDENT=2]Here I come to save the day!
Armed with my openSUSE, I’m on my way!

[/INDENT]

:wink:

Hi everybody!
I want to explain the reason for why i do this og why i use extn and not FAT32.
I’m setting up a wifi-router and install DD-WRT-firmware instead of the original. ddwrt gives me many extra tools and possibilities for running extra services like YAMon. To do this i need a “disksystem”. The routers disksystem is in RAM and is cleared during reboot.
To manage to get Automount to work, i need extn-filesys on the stick, because i can use UUID to set an certain mountpoint. FAT32 don’t give me UUID.

So the problem is that files created on the stick is owned by root and owner ronsim i set using chown on OpenSUSE don’t exist on router, but only as user-ID:1000.
This can cause some issues with filerights.
I use my OpenSUSE 13.1 to format the memorystick and copy files into it, but after its been used on the router, something happens with the filerights on the stick.

So this is the reason i try to do this! :slight_smile:

RS

I assume that changing the UID on that router is out of the question. Then it would be best to have a user with UID 1000 on your openSUSE system also. Now I wonder, because IIRC openSUSE starts to give out UIDs from 1000, thus normaly you should have one already.

You can check that by looking in /etc/passwd. Fields there are : separated. The third field is the UID. Obviously there are two cases:

  1. There is no such user. Then that is fine IMHO. You then create a new user special for maintaining the router bussiness with UID 1000 (using YaST e.g., it allows you to choose a UID different from it’s default). Of course you then chown the root of the sticky fs to be owned by that user.
  2. There is already a user with UID 1000. Now you can walk two pathes. When you (as a person) “own” that user, you could use that user in the future for the sticky/router. When the user with UID 1000 is a different person or you do not want that user to use for the sticky (because the user is there for something completely different), you can change the currect user using 1000 to another number and then do like 1 above.

Changing a users UID involves a bit care. As root change the number in the corresponding line in /etc/passwd. All files owned by that user must change ownership now. When that is a well behaving user, those files are only inside his home directory and a chown -R from the home directory should do it. When you need assistence in finding files outside the home directory, please come back and ask.

On 2014-02-05 11:36, ronnys wrote:

> So the problem is that files created on the stick is owned by root and
> owner ronsim i set using chown on OpenSUSE don’t exist on router, but
> only as user-ID:1000.

Doesn’t matter. The name of the user is irrelevant. The filesystem only
knows the number, the UID.

> This can cause some issues with filerights.
> I use my OpenSUSE 13.1 to format the memorystick and copy files into it,
> but after its been used on the router, something happens with the
> filerights on the stick.

Just find out what permissions and UIDs the router uses, and then set
them the same way on the computer.

Hint: there is an “ls” variant that displays the UIDs instead of names.
See the manual.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Hi again!
The memorystick is working on my wifi-router and automount works perfect.
Problem is that when i umount it on router og plug it in my OpenSUSE, there is a long delay before it mount.
My earlier problem still continue.

It shows up in fdisk;

# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x81c02799

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200    7  HPFS/NTFS/exFAT
/dev/sda2          616448   927137791   463260672   83  Linux
/dev/sda3       927137792   972572671    22717440    7  HPFS/NTFS/exFAT
/dev/sda4       972572672   976756735     2092032    c  W95 FAT32 (LBA)

Disk /dev/sdb: 24.0 GB, 24015495168 bytes, 46905264 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 label type: dos
Disk identifier: 0x00090c12

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4192255     2095104   82  Linux swap / Solaris
/dev/sdb2         4192256    46903295    21355520   83  Linux

Disk /dev/sdc: 2007 MB, 2007498752 bytes, 3920896 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 label type: dos
Disk identifier: 0x71ec093d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     3919871     1958912   83  Linux

but not in df:

# df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sdb2       20889188  13735136   6069892  70% /
devtmpfs         4049240        24   4049216   1% /dev                                                                                                  
tmpfs            4062976      1352   4061624   1% /dev/shm
tmpfs            4062976      1212   4061764   1% /run
tmpfs            4062976         0   4062976   0% /sys/fs/cgroup
tmpfs            4062976      1212   4061764   1% /var/lock
tmpfs            4062976      1212   4061764   1% /var/run
/dev/sda2      455859552 222975300 209704836  52% /home

I can mount it manual og access the memorystick;

linux-8db7:/home/ronsim # mount /dev/sdc1 /opt/YAMon
linux-8db7:/home/ronsim # cd /opt/YAMon/
linux-8db7:/opt/YAMon # ls -la
totalt 32
drwxr-xr-x  5 ronsim users  4096 feb.   4 15:33 .
drwxr-xr-x 14 root   root   4096 jan.  31 11:04 ..
drwx------  2 root   root  16384 feb.   4 12:07 lost+found
drwx------  4 ronsim users  4096 feb.   4 15:33 .Trash-1000
drwxr-xr-x  7 ronsim users  4096 feb.   5 10:06 YAMon
linux-8db7:/opt/YAMon # cd YAMon/
linux-8db7:/opt/YAMon/YAMon # ls -la
totalt 28
drwxr-xr-x 7 ronsim users 4096 feb.   5 10:06 .
drwxr-xr-x 5 ronsim users 4096 feb.   4 15:33 ..
drwxr-xr-x 2 root   root  4096 feb.   5 01:00 daily-bu
drwxr-xr-x 2 ronsim users 4096 feb.   5 01:00 data
drwxr-xr-x 2 ronsim users 4096 feb.   5 10:07 logs
drwxr-xr-x 3 ronsim users 4096 feb.   5 10:08 Setup
drwxr-xr-x 3 root   root  4096 feb.   5 10:05 wwwBU
linux-8db7:/opt/YAMon/YAMon # cd Setup/
linux-8db7:/opt/YAMon/YAMon/Setup # ls -la
totalt 116
drwxr-xr-x 3 ronsim users  4096 feb.   5 10:08 .
drwxr-xr-x 7 ronsim users  4096 feb.   5 10:06 ..
-rw-r--r-- 1 ronsim users  4669 jan.   1 14:48 config.file
-rw-r--r-- 1 ronsim users  4669 jan.   1 14:48 default config.file
-rw-r--r-- 1 root   root    127 feb.   5 10:08 monitor-05-02-2014.log
-rw-r--r-- 1 ronsim users 13735 jan.   8 14:53 readme.txt
-rw-r--r-- 1 ronsim users   701 okt.   7 21:02 traff.sh
drwxr-xr-x 3 ronsim users  4096 jan.  17 01:35 www
-rwxr-xr-x 1 ronsim users 26300 feb.   2 00:38 yamon.sh
-rwxr-xr-x 1 ronsim users 26238 jan.  17 01:26 yamon.sh.old
-rwxr-xr-x 1 ronsim users   108 sep.  18 08:02 yamon.shutdown
-rwxr-xr-x 1 ronsim users    39 sep.  21 22:06 yamon.startup

So all files that is copy on my OpenSUSE as ronsim shows up with owner ronsim.
All files created on the router show up as owner root.

In my OpenSUSE /etc/passwd there is the line;

ronsim:x:1000:100:Ronny Simonsen:/home/ronsim:/bin/bash

So why is this delay on 15-20minutes before the memorystick automount on OpenSUSE?

Please start a new thread on that. IMHO it needs a new topic.

On 2014-02-05 14:36, ronnys wrote:
>
> Hi again!
> The memorystick is working on my wifi-router and automount works
> perfect.

Ok.

> Problem is that when i umount it on router og plug it in my OpenSUSE,
> there is a long delay before it mount.

That’s a different issue.

> My earlier problem still continue.

> So all files that is copy on my OpenSUSE as ronsim shows up with owner
> ronsim.

Yes. Of course.

> All files created on the router show up as owner root.

Yes. Of course.

I see no problem at all…


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

As said, what you create on the system with user ronsim (1000) is owned by 1000 (ronsim). That should not surprise you.

And when things created on the router are owned by 0 (root), then that is contrary to your statement that the roouter uses 1000:

So the problem is that files created on the stick is owned by root and owner ronsim i set using chown on OpenSUSE don’t exist on router, but only as user-ID:1000.

But we may have misunderstood you here.

So, when the router uses only UID 0, then everything on the stick should of course be owned by 0. And then all is owned by root (0) when the stick is on your PC. That is naturaly. It makes using the stick on the PC tricky, because only root can manage it and that means that you are going to use root for mere simple tasks that you would never do as root otherwise.

The problem originates in the policy of the router, not the PC.

And like others say, when you have a sticky detach problem, start a new thread. The present title does not cover that problem and thus your audience will be limited here.

On 2014-02-06 11:36, hcvv wrote:

> So, when the router uses only UID 0, then everything on the stick should
> of course be owned by 0. And then all is owned by root (0) when the
> stick is on your PC. That is naturaly. It makes using the stick on the
> PC tricky, because only root can manage it and that means that you are
> going to use root for mere simple tasks that you would never do as root
> otherwise.
>
> The problem originates in the policy of the router, not the PC.

Exactly.

What I do on another Linux embedded device I have is change the group
permission of all files to allow write, every single time I plug it on
the computer, with a script I keep on it. Thus I only need one operation
made by root on the computer.

Of course, I do not know if this change may cause any problem in the OP
device.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))