WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: (中文) How can I automatically load all partitions when tinycore starts?  (Read 337998 times)

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
How can I automatically load all partitions when tinycore starts? Especially FAT32/NTFS partition?
请问下怎样在tinycore启动的时候自动加载所有的分区?特别是FAT32/NTFS分区?
我用的是TinyCorePure64-12.0.iso,http://www.tinycorelinux.net/12.x/x86_64/release/
54bc11152740fe4b0148521fd5f39639  CorePure64-12.0.iso
我在app中下载了getlocale.tcz,并且用sudo getlocale.sh设置了locale为zh_CN.UTF-8,grub4dos/grub2启动参数里面也添加了 lang=zh_CN.UTF-8

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
为了发这个帖子,我用了2天的时间,我太难了。大部分的内容无法发送。
总是提示:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@forum.tinycorelinux.net to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
« Last Edit: January 12, 2022, 04:07:05 PM by liuzhaoyzz »

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
my grub2 menu:
menuentry "/TinyCorePure64-12.0/boot/vmlinuz64" "/TinyCorePure64-12.0/boot/vmlinuz64" {
search --no-floppy --set --file $2
probe -u ($root) -s uuid
linux $2 quiet loglevel=3 tce=UUID="$uuid"/TinyCorePure64-12.0/cde/ showapps vga=791 lang=zh_CN.UTF-8 tz=GMT-8
initrd /TinyCorePure64-12.0/boot/corepure64.gz
}

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
sudo passwd root
su




Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Tiny Core is not your average linux system.
The /etc/fstab is rebuilt every time you boot, every time you plug-in a USB.
If I were you, I'd append this to /opt/bootlocal.sh (without "sudo")
Code: [Select]
mount -t ntfs-3g /dev/sda2 /mnt/sda2and run a backup
Code: [Select]
$ filetool.sh -bvAlso, add "util-linux.tcz" and "ntfs-3g.tcz" into your /etc/sysconfig/tcedir/onboot.lst

However, before you do any of that, there's a huge problem with your setup.
my grub2 menu:
menuentry "/TinyCorePure64-12.0/boot/vmlinuz64" "/TinyCorePure64-12.0/boot/vmlinuz64" {
search --no-floppy --set --file $2
probe -u ($root) -s uuid
linux $2 quiet loglevel=3 tce=UUID="$uuid"/TinyCorePure64-12.0/cde/ showapps vga=791 lang=zh_CN.UTF-8 tz=GMT-8
initrd /TinyCorePure64-12.0/boot/corepure64.gz
}
Have you remastered your ISO and boot the system from there ?
How did you setup your system ?

Tiny Core本就不是一套常規的linux系統
/etc/fstab是會一直變的,你硬要改它也只會被刷掉而已。
我會這樣做,在/opt/bootlocal.sh加入mount指令。(切記,不要sudo)
Code: [Select]
mount -t ntfs-3g /dev/sda2 /mnt/sda2然後備份一下
Code: [Select]
$ filetool.sh -bv還有在你的onboot.lst加入"util-linux.tcz"跟"ntfs-3g.tcz"以便開機自動載入。
最後我要問你那個cde是哪來的?
你有自己動手魔改ISO檔嗎?你系統是怎麼裝的?
« Last Edit: January 12, 2022, 08:39:39 PM by polikuo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Hi liuzhaoyzz
The attached script will mount all drives that have been detected but are not currently mounted.
After you have downloaded it, remember to make it executable:
Code: [Select]
chmod 775 MountAll.shMake sure you installed  ntfs-3g.tcz  onboot.

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
非常感谢您的回复和指导!

Quote
最後我要問你那個cde是哪來的?
原始的TinyCorePure64-12.0.iso用7z或者winrar解压缩之后,就是这个结构啊。我就是直接解压缩的。
tree /f .
卷 F2 的文件夹 PATH 列表
卷序列号为 00000200 0005:BF35
J:\TINYCOREPURE64-12.0
├─EFI
├─boot
└─cde
    │  copy2fs.lst
    │  onboot.lst
    │  xbase.lst
    └─optional
            Xfbdev.tcz
            Xfbdev.tcz.md5.txt

Quote
你有自己動手魔改ISO檔嗎?你系統是怎麼裝的?
我没有改过TinyCorePure64-12.0.iso,我是直接解压缩,放到FAT32分区,然后添加引导罢了。
« Last Edit: January 13, 2022, 02:32:11 AM by liuzhaoyzz »

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
mount -t ntfs-3g /dev/sda2 /mnt/sda2

我现在的主要问题是,在进入系统之前,我不知道设备号倒底是什么样子的,比如/dev/sda1,/dev/sdc3,dev/sda2,所以我想借鉴/usr/sbin/rebuildfstab里面的部分代码来实现遍历,自动挂载所有的分区。

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
Thank you for your reply!
Make sure you installed  ntfs-3g.tcz  onboot.
Yes,I have installed ntfs-3g.tcz.

但是运行MountAll.sh挂载的话,FAT32和NTFS分区会出现乱码现象,这段代码和wbar-mounttool手工挂载分区没有区别,一样会产生乱码。
我想要实现的是,对于NTFS分区,用sudo mount -t ntfs-3g命令挂载,如果用sudo mount "/mnt/$F"会乱码。

对于FAT32分区,我想要用sudo mount -t vfat -o iocharset=utf8来挂载,如果用sudo mount "/mnt/$F"会乱码,因为sudo mount "/mnt/$F"缺乏-o iocharset=utf8参数。

所以我原本想利用rebuildfstab来修改,因为里面已经有了遍历的语句了。



Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
Re: (中文) How can I automatically load all partitions when tinycore starts?
« Reply #10 on: January 13, 2022, 04:00:31 AM »
在/opt/bootlocal.sh加入mount指令
在onboot.lst加入了util-linux.tcz跟ntfs-3g.tcz
我试过了,我创建了一个/linux2/tinycore/opt目录,/opt/bootlocal.sh加入mount指令,保存设置,关机重启,但上面的脚本不工作啊?
我在/linux2/tinycore/optional目录中创建了一个bootlocal.sh脚本,加入mount指令,保存设置,关机重启,但上面的脚本也不工作啊?
奇怪的很。

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
Re: (中文) How can I automatically load all partitions when tinycore starts?
« Reply #11 on: January 13, 2022, 04:16:39 AM »
还有个问题,我的tinycore解压缩之后放在/dev/sdd2目录,开机的时候,这个/dev/sdd2会自动挂载,但是自动挂载的磁盘会有乱码,因为默认的mout缺乏-o iocharset=utf8参数。
所以只有想办法从根本上修改/etc/fstab或者/usr/sbin/rebuildfstab.

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
Re: (中文) How can I automatically load all partitions when tinycore starts?
« Reply #12 on: January 13, 2022, 04:19:41 AM »
tc@box:~$ mount|grep dmask
/dev/sdd2 on /mnt/sdd2 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

vfat部分参数:

       codepage=value
              在FAT系列文件系统上,"8.3"格式的短文件名以特定的代码页进行存储(可以通过chcp命令查看),
              但长文件名却以Unicode进行存储。此选项的作用就是指定将长文件名转换为短文件名时使用的代码页。
              默认使用内核的FAT_DEFAULT_CODEPAGE值。简体中文一般使用936代码页(codepage=936)。

       iocharset=value
              指定默认以什么字符集显示文件名,必须与系统的locale设置保持一致。默认使用内核的FAT_DEFAULT_IOCHARSET值。
              例如在"en_US.UTF-8"的情况下应该使用"utf8"。
              [注意]应谨慎使用"iocharset=utf8",它会导致FAT文件系统上的文件名变得大小写敏感。


看了下$FAT_DEFAULT_CODEPAGE和$FAT_DEFAULT_IOCHARSET都是空值!
/home/tc/.ashrc
#export FAT_DEFAULT_CODEPAGE=936
#export FAT_DEFAULT_IOCHARSET=cp936

export FAT_DEFAULT_CODEPAGE=utf8
export FAT_DEFAULT_IOCHARSET=utf8

export codepage=utf8
export iocharset=utf8
修改了也没用。

Offline polikuo

  • Hero Member
  • *****
  • Posts: 714
Re: (中文) How can I automatically load all partitions when tinycore starts?
« Reply #13 on: January 13, 2022, 04:29:42 AM »
我没有改过TinyCorePure64-12.0.iso,我是直接解压缩,放到FAT32分区,然后添加引导罢了。

This could cause serious problems, cde is a predefined directory specifically for CDs.

You should rename it to tce to prevent unwanted behavior.

這很可能在日後造成不必要的問題,cde是專為光碟設計的。
天曉得系統內有多少程式會誤判你的配置,請改成tce避免不必要的麻煩。

但是运行MountAll.sh挂载的话,FAT32和NTFS分区会出现乱码现象,这段代码和wbar-mounttool手工挂载分区没有区别,一样会产生乱码。

You can refactor the script to fit your needs.
I can't post my modification due to the forum internal error.
你可以自己改阿
論壇關係,我無法附上我的版本。

Offline liuzhaoyzz

  • Jr. Member
  • **
  • Posts: 75
Re: (中文) How can I automatically load all partitions when tinycore starts?
« Reply #14 on: January 13, 2022, 04:31:51 AM »
但是如果我手工修改corepure64.gz\corepure64.cpio\usr\sbin\rebuildfstab,
下一次tinycore版本一更新我又要改,我改了之后,
下一次tinycore版本一更新我又要改,我改了之后,
下一次tinycore版本一更新我又要改,我改了之后,
下一次tinycore版本一更新我又要改,我改了之后,
.....
Oh my god!no!