WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Change the device name of a SSD drive  (Read 4795 times)

Offline Fven

  • Newbie
  • *
  • Posts: 29
Change the device name of a SSD drive
« on: April 25, 2020, 09:18:53 AM »
Hello,
I have made a installation of TC11.1 (64 bits) on a uefi thin client. I used this tutorial . The partitions on the internal SSD drive are /mnt/mmcblk1p1 and /mnt/mmcblk1p2. sometimes it is /mnt/mmcbik0p1.
Is it possible to change it to /mnt/sdd1 and /mnt/sdd2?
I tried a soft link and modified fstab but unfortunately that didn't work.
« Last Edit: April 25, 2020, 09:20:24 AM by Fven »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: Change the device name of a SSD drive
« Reply #1 on: April 25, 2020, 10:02:17 AM »
You could use "search --no-floppy --fs-uuid --set=root <partition_uuid>" to make sure it was always /mnt/mmcbik0p1 for example.

Perhaps you could use a udev rule to set it to /mnt/sdd1?

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #2 on: April 29, 2020, 04:55:12 AM »
Hi Juanito,
I think "mmcbik" is the name of the internal flash disk. When I boot from a USB drive, partition 1 (fat32, boot) becomes: /mnt/mmcbik1p1 and partition 2 (ext2) /mnt/mmcbik1p2. When I boot from the internal ssd it is /mnt/mmcbik0p1. With gparted I tried to change the name of the ssd but without success.
I read a lot about "udev rules" on the forum and on the internet. But honestly, I don't get it. I know udev should be in: /etc/udev/rules.d/ and a reference in: opt/.filetool.lst
I have not found an example of how to rename the disk to sda1 and sda2. Could point me in the right direction? Thanks.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: Change the device name of a SSD drive
« Reply #3 on: April 29, 2020, 06:14:59 AM »
I'm not an expert on this, but I think udev would be the only way to change the name.

Why do you want to change the name?

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #4 on: April 29, 2020, 06:44:28 AM »
I use the SSD to store data. To access it with the terminal I always have to use the full device name (cd /mnt/mmcbik0p1/). I regularly make a typo here and sda1 is easier to read in the notes I make.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: Change the device name of a SSD drive
« Reply #5 on: April 29, 2020, 06:48:10 AM »
Can you make a symlink, i.e. sudo ln -s /mnt/mmcblk0p1 /mnt/sda1?

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #6 on: April 29, 2020, 07:10:03 AM »
I also thought that would be the easiest way.
Code: [Select]
tc@box:~$ sudo ln -s /mmcnlk1p1 /mnt/sda1
tc@box:~$ sudo ln -s /mmcnlk1p2 /mnt/sda2

tc@box:/mnt$ ls
mmcblk1p1/ mmcblk1p2/ sda1       sda2

tc@box:/mnt$ cd sda1
sh: cd: can't cd to sda1: No such file or directory
tc@box:/mnt$ cd sda2
sh: cd: can't cd to sda2: No such file or directory

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: Change the device name of a SSD drive
« Reply #7 on: April 29, 2020, 07:13:59 AM »
Hi Fven
I also thought that would be the easiest way.
Code: [Select]
tc@box:~$ sudo ln -s /mmcnlk1p1 /mnt/sda1
tc@box:~$ sudo ln -s /mmcnlk1p2 /mnt/sda2

Re-read the answer Juanito gave you. That should have been:
Code: [Select]
tc@box:~$ sudo ln -s /mnt/mmcblk1p1 /mnt/sda1
tc@box:~$ sudo ln -s /mnt/mmcblk1p2 /mnt/sda2

    [EDIT]: Fixed typo, changed  mmcnlk  to  mmcblk.  Rich
« Last Edit: April 29, 2020, 07:20:47 AM by Rich »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: Change the device name of a SSD drive
« Reply #8 on: April 29, 2020, 07:15:28 AM »
That should be:
Code: [Select]
$ sudo ln -s /mnt/mmcblk1p1 /mnt/sda1

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #9 on: April 29, 2020, 07:48:32 AM »
Hi Rich,
Sorry for the mistake. I had to retype everything.
Code: [Select]
tc@box:~$ sudo ln -s /mnt/mmcblk1p1 /mnt/sda1
tc@box:~$ sudo ln -s /mnt/mmcblk1p2 /mnt/sda2

tc@box:~$ cd /mnt
tc@box:/mnt$ ls
mmcblk1p1/ mmcblk1p2/ sda1/      sda2/

tc@box:/mnt$ cd sda1
tc@box:/mnt/sda1$ ls
mmcblk1p1

tc@box:/mnt/sda1$ cd ../sda2
tc@box:/mnt/sda2$ ls
mmcblk1p2

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: Change the device name of a SSD drive
« Reply #10 on: April 29, 2020, 08:13:15 AM »
Hi Fven
Code: [Select]
----- Snip -----
tc@box:~$ cd /mnt
tc@box:/mnt$ ls
mmcblk1p1/ mmcblk1p2/ sda1/      sda2/

tc@box:/mnt$ cd sda1
tc@box:/mnt/sda1$ ls
mmcblk1p1

 ----- Snip -----
Something is wrong there.
The  sda1  and  sda2  links in the  ls  command should not have a trailing  /
The result of the  cd  command should look like this:
Code: [Select]
tc@box:/mnt$ cd sda1
tc@box:/mnt/mmcblk1p1$

Here's what it looks like if I create a link:
Code: [Select]
tc@E310:~$ sudo ln -s /mnt/sda1/ /mnt/xyzzy
tc@E310:~$ cd /mnt/
tc@E310:/mnt$ ls
sda1/  sda2/  sda3/  sda6/  sr0/  sr1/  test/  xyzzy
tc@E310:/mnt$ cd xyzzy/
tc@E310:/mnt/sda1$ ls
boot/  home/  lost+found/  opt/  tce/  tce64/  tce64TC11b1/  tce64TC11b1.bak/
tc@E310:/mnt/sda1$

Did you have  /mnt/sda1  and  /mnt/sda2  directories already present when you executed the link commands?

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #11 on: April 29, 2020, 08:21:17 AM »
Hi Juanito, Rich,
I have found the solution. There should be a / behind mmcblk1p1
Code: [Select]
tc@box:/mnt$  sudo ln -s /mnt/mmcblk1p1/ /mnt/sda1
tc@box:/mnt$  sudo ln -s /mnt/mmcblk1p2/ /mnt/sda2

Thanks

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: Change the device name of a SSD drive
« Reply #12 on: April 29, 2020, 08:37:47 AM »
Hi Fven
... There should be a / behind mmcblk1p1 ...
I don't think that was the cause of your problem. I suspect it was caused by having  /mnt/sda1  and  /mnt/sda2  directories already
present when you executed the link commands. I was able to duplicate your problem by creating a link to an existing directory.

Offline Fven

  • Newbie
  • *
  • Posts: 29
Re: Change the device name of a SSD drive
« Reply #13 on: April 29, 2020, 08:58:51 AM »
You're right. My mistake. I probably didn't see sda1 and sda2 and rebooted Tiny Core just before I made the last changes.
thanks again.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Change the device name of a SSD drive
« Reply #14 on: April 29, 2020, 05:07:28 PM »
hi Fven,

I notice you type "mmcbik" instead of "mmcblk". Is mmcbik valid?

I find it easy to remember this way:

"mmc"
"blk0" or "blk1" for block 0 or block 1
"p0" or "p1" for partition 1 or 2
 
To me "sda" or "sdb" refers to a USB drive.

I also define shortcuts, m1, c1, u1 etc in .ashrc to make life easier.

Code: [Select]
# ~/.ashrc: Executed by SHells.
#
. /etc/init.d/tc-functions
if [ -n "$DISPLAY" ]
then
        `which editor >/dev/null` && EDITOR=editor || EDITOR=vi
else
        EDITOR=vi
fi
export EDITOR

PS1='\[\033[01;32m\]\u@\h:\[\033[00m\]\[\033[01;34m\]\w\$\[\033[00m\] '
export PS1

TCEDEV="/dev/$(readlink /etc/sysconfig/tcedir | cut -d '/' -f3)"
TCEMNT="/mnt/$(readlink /etc/sysconfig/tcedir | cut -d '/' -f3)"
BOOTDEV=${TCEDEV%%?}1
BOOTMNT=${TCEMNT%%?}1

# Alias definitions.
#
alias df='df -h'
alias du='du -h'

alias ls='ls -p'
alias ll='ls -l'
alias la='ls -la'

# Avoid errors... use -f to skip confirmation.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'

# Change directory to
alias ce="cd $TCEMNT/tce"
alias ceo="cd $TCEMNT/tce/optional"
alias c1="cd $BOOTMNT"
alias c2="cd $TCEMNT"

# Mount partition
alias m1="mount $BOOTMNT"
alias m2="mount $TCEMNT"

# Unmount partition
alias u1="umount $BOOTMNT"
alias u2="umount $TCEMNT"

# Edit config files
alias vicfg="vi $BOOTMNT/config.txt"
alias vicmd="vi $BOOTMNT/cmdline.txt"


It looks like Paul has made some enhancements to our .ashrc over the years. Thanks Paul!

regards
Greg