Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOWTO: Configure USB Drive on CK3E

I've been putting SDCards into the PowerPC based PPMACs for some time now and they always configure to /dev/sdb This makes it easy of course to mount the first partition by configuring fstab to mount the first partition by device name, i.e. /dev/sdb1 I always mount to a folder I created named /mnt/sdcard

When using the CK3E PPMAC it seems that the system configures the internal flash drive differently depending on whether or not a USB flash key is plugged in! This makes it difficult to edit the /etc/fstab file to use a specific device path.

I started to use the concept of the unique identifier to mount the USB disk, and it worked, it is just that on a production machine you want to be able to hot swap in a USB drive if you are having problems, or at least I do! :o)

So anyway, I stumbled upon a method to mount the USB drive by the USB port its plugged into. The system creates a path in /dev/disks/by-path that represents the bus and port it is plugged into. This doesn't change by USB disk type, brand, or configuration AFAIK. So, assuming all of you USB disks are formatted for the same filesystem (I use ext4 for reliability) it should "just work" for all drives.

Heres how to do it:

1) Connect to the PPMAC with a good SSH terminal like PuTTY or even the debug virtual serial port (the micro USB connector on the top of the unit). Go to Device manager if you don't know what port it is assigned by windows. PuTTY is easier though and if you are doing work with the PPMAC it will be your best friend eventually so you should get used to it :o)

2) Verify that you have the same USB port ID as me:

ls /dev/disk/by-path

Assuming your disk is partitioned you will see this line amongst others:

This seems to be consistent no matter what type of USB drive I plug in to the front panel port.

3) make the root partition writeable
mount -o remount,rw /

4) Edit the fstab file that will persist at reboot

pico /.readonly/etc/fstab

Once in the Pico editor copy the following line to your clipboard (CTRL-C) and then paste it into the PuTTY terminal using the right mouse button (You could type it if you are masochistic).

/dev/disk/by-path/ /mnt/sdcard ext4 defaults 0 2

a typical fstab line for a second disk looks like:

devpath mountpath fstype options 0 2

Before saving the fstab file change the filesystem type to that of which you have partitioned your USB device and modify the mount point path to something that you like (but make sure there is a directory for it beforehand.... you can do that in a later step). I recommend ext4 and a directory in /mnt

5) Write file and exit Pico (CTRL-O, answer prompt, then CTRL-X)

6) Create the mount point if you haven't already, e.g.
mkdir /mnt/sdcard

7) Make the drive readonly
mount -o remount,rw /

8) Restart the PPMAC

9) After a little while Restart PuTTY and login again and you should have a writeable flash drive available!

root@192.168.xx.xx:/opt/ppmac# mount | grep sdcard
/dev/sda1 on /mnt/sdcard type ext4 (rw,relatime,data=ordered)

root@192.168.xx.xx:/opt/ppmac# ls /mnt/sdcard/

I hope this helps. I tried this with two different USB flash drives formatted for EXT4 and they both booted and mounted to /mnt/sdcard for me.

A priceless post Kejr, thank you a thousand times for it.
I found it incredible that the internal memory is relegated to /dev/sdb when the unit starts with a flash drive plugged.

So, same story for me, I used to insert SD cards in my other DT units and to edit the fstab for mounting the SD card on a specific path. When I was receiving any new unit, I was replacing the fstab file, among others, and that was it. Now it is more tricky: the fstab file contains the internal memory UUID ! So it must be edited. And your idea of using the "by-path" is just great.

On my side, I have switched to FAT32. Our computers are now all in Windows10 and it is not possible to install ext fs drivers anymore. And we sometime need to recover data from the flash drive manually. So, for the record, I am using the following instruction in fstab:

/dev/disk/by-path/ /media/disk-0 vfat rw,user,umask=000 0 2

I am mounting the vfat flash drive on /media/disk-0. The Linux cannot manage the access right using chmod on FAT32 fs, so the mounting options are just here to mount the flash drive in rw mode.

Forum Jump:

Users browsing this thread: 1 Guest(s)