How to change file system configurations

161 views
Skip to first unread message

Hongwei Qin

unread,
Sep 5, 2019, 3:56:25 AM9/5/19
to Android-x86
Android-x86 community geniuses,
I'm a file system developer and want to test my self-defined file system on android-x86. (I run pie-x86 on qemu).
In order to achieve my ultimate goal, I need to try to run f2fs instead of ext4 on my emulated device first.
Current implementation doesn't allow me to do so. I guess I need to: 1) add a mkfs.f2fs into the source code and 2) maybe change the fstab to indicate f2fs as my selected file system.
After googling I still can't find the right way to do it.
My first question:
    Can anyone tells me where should I start from?

My second question:
    When trying to figure out the physical layout of my emulated storage, I type the following commands:

x86_64:/ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           996M  4.4M  992M   1% /
/dev/loop0      1.7G  1.6G  136M  93% /system
/dev/block/sda1  15G  1.8G   12G  14% /data
tmpfs           996M  316K  996M   1% /dev
tmpfs           996M     0  996M   0% /mnt
none            996M     0  996M   0% /cache
/data/media      15G  1.8G   12G  14% /storage/emulated

It shows me that I have a loop0 device mounted on /system and a sda1 mounted on /data. Others are just ramdisks.
What surprises me is the loop0 device. I can't get any information about it.
`losetup -a` doesn't output anything.
I can't even find a loop0 under /dev
x86_64:/ $ ls /dev
__properties__  device-mapper  lightnvm           psaux  tty10 tty22 tty34 tty46 tty58 ttyS3   vcsu7       
ashmem          dri            loop-control       ptmx   tty11 tty23 tty35 tty47 tty59 tun     vga_arbiter 
binder          event-log-tags mem                pts    tty12 tty24 tty36 tty48 tty6  uhid    vndbinder   
block           fd             memcg              random tty13 tty25 tty37 tty49 tty60 uinput  xt_qtaguid  
cg2_bpf         fscklogs       memory_bandwidth   rfkill tty14 tty26 tty38 tty5  tty61 urandom zero        
console         full           msr0               rtc0   tty15 tty27 tty39 tty50 tty62 vcs     
cpu0            fuse           msr1               sg0    tty16 tty28 tty4  tty51 tty63 vcs1    
cpu1            graphics       msr2               sg1    tty17 tty29 tty40 tty52 tty7  vcs7    
cpu2            hpet           msr3               socket tty18 tty3  tty41 tty53 tty8  vcsa    
cpu3            hwbinder       network_latency    stune  tty19 tty30 tty42 tty54 tty9  vcsa1   
cpu_dma_latency input          network_throughput tty    tty2  tty31 tty43 tty55 ttyS0 vcsa7   
cpuctl          kmsg           null               tty0   tty20 tty32 tty44 tty56 ttyS1 vcsu    
cpuset          kmsg_debug     port               tty1   tty21 tty33 tty45 tty57 ttyS2 vcsu1 

Wierd, wierd and wierd! Any ideas about it?

Thank you :)

Chih-Wei Huang

unread,
Sep 5, 2019, 5:20:38 AM9/5/19
to Android-x86
Hongwei Qin <glqinh...@gmail.com> 於 2019年9月5日 週四 下午3:56寫道:
We packed system in system.sfs or system.img
and mount it by -o loop.
You can read the init script to get more concrete idea:

https://osdn.net/projects/android-x86/scm/git/bootable-newinstaller/blobs/oreo-x86/initrd/init

To mount system on f2fs, the kernel must have f2fs driver built-in.
(currently it doesn't have)
So you need to customize the kernel.

--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Hongwei Qin

unread,
Sep 5, 2019, 9:32:40 AM9/5/19
to Android-x86
Many thanks to your kind reply.
After customizing the kernel (making f2fs build-in), I still can't format the storage partition as f2fs.

Here's my workflow:

1, Start the VM by the following script:
#!/bin/bash
qemu-system-x86_64 \
-smp 4 \
-m 2048 \
-enable-kvm \
-display sdl \
-net nic -net user \
-k en-us \
-boot d\
-hda /mnt/sdc/qhw/images/android.qcow2 \
-cdrom $1

2, choose to install android-x86 to harddisk
3, Modify disk partition
    I only have one disk and I allocate only one partition with boot flag chosen
4, write the partition table and come back
5, choose the partition I've just allocated, and then press OK
6, Here, I can choose which kind of file system I'd like to format the partition as. I have only 3 choices: ext4, ntfs, fat32.

Is this the correct way to choose a file system for my partition? How can I add a new option (in this case: f2fs).
BTW, what if I want my /data to be f2fs while others remain ext4. I guess I should allocate two partitions at the aforementioned step 3. Then what's next?

--
Hongwei

Chih-Wei Huang

unread,
Sep 5, 2019, 10:11:55 PM9/5/19
to Android-x86
Hongwei Qin <glqinh...@gmail.com> 於 2019年9月5日 週四 下午9:32寫道:
>
> Many thanks to your kind reply.
> After customizing the kernel (making f2fs build-in), I still can't format the storage partition as f2fs.
>
> Here's my workflow:
>
> 1, Start the VM by the following script:
> #!/bin/bash
> qemu-system-x86_64 \
> -smp 4 \
> -m 2048 \
> -enable-kvm \
> -display sdl \
> -net nic -net user \
> -k en-us \
> -boot d\
> -hda /mnt/sdc/qhw/images/android.qcow2 \
> -cdrom $1
>
> 2, choose to install android-x86 to harddisk
> 3, Modify disk partition
> I only have one disk and I allocate only one partition with boot flag chosen
> 4, write the partition table and come back
> 5, choose the partition I've just allocated, and then press OK
> 6, Here, I can choose which kind of file system I'd like to format the partition as. I have only 3 choices: ext4, ntfs, fat32.

Yes, the installer only supports these.
You need to modify installer script to add f2fs.
Or you can just do it manually.
(switch to other VT by Alt-F2, Alt-F3)

> Is this the correct way to choose a file system for my partition? How can I add a new option (in this case: f2fs).
> BTW, what if I want my /data to be f2fs while others remain ext4. I guess I should allocate two partitions at the aforementioned step 3. Then what's next?

Yes, you can do that manually, then add
DATA=sda3 (suppose data partition is /dev/sda3)
to kernel cmdline.

Jon West

unread,
Sep 5, 2019, 10:15:41 PM9/5/19
to Android-x86
To add ant new format options, you will need to make those changes in bootable/newinstaller - https://osdn.net/projects/android-x86/scm/git/bootable-newinstaller/blobs/pie-x86/install/scripts/1-install

Hongwei Qin

unread,
Sep 6, 2019, 3:42:20 AM9/6/19
to Android-x86
Thank you! It's very helpful.
Reply all
Reply to author
Forward
0 new messages