Does pmedia=usbflash for a usb pendrive saves it's writecycle?(solved)

Moderators: 666philb, Forum moderators

Post Reply
User avatar
mr_gs
Posts: 38
Joined: Tue Dec 14, 2021 6:39 am
Has thanked: 7 times
Been thanked: 8 times

Does pmedia=usbflash for a usb pendrive saves it's writecycle?(solved)

Post by mr_gs »

My OS: fossapup 9.5 64bit
When I renamed a big(1GB) file(booted with pmedia=usbflash), it puppy took long time to save it to my flash drive. I was wondering why puppy took that much time to save a file that was renamed.
Out of my curiosity, I repeated the same experiment (remaining file) with pmedia=usbhd. But this time it took less than 5 seconds for puppy to shutdown.

So my question is: Is pmedia=usbflash good for flash drive's writecycle (as it rewrited the same file when I renamed it)?. Correct me if I am wrong.

Last edited by mr_gs on Fri Apr 22, 2022 4:11 am, edited 1 time in total.

Fossapup 9.5 64bit Kernel 5.4.53
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
8GB RAM
Intel (R) UHD Graphics

User avatar
bigpup
Moderator
Posts: 6403
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 757 times
Been thanked: 1325 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by bigpup »

Not exactly sure what you are saying about rewritting a file with pmedia=?

If you are saying using pmedia=usbflash in the boot loader menu entry that boots Fossapup64 9.5.
Yes.
That does make Puppy boot in a way that does limit the writes to the USB.

Puppy boots in pupmode 13
The save is mounted read/write, but writes to it are limited.
Some memory is used as a save ram disk to store any changes that normally would be directly written into the save.
A save icon should show on the desktop.

Writes to the save are done by:
Clicking the save desktop icon.
A set time period to save.
A shutdown or reboot.
This takes time to empty the save ram disk into the actual save file/folder.

These save settings are controlled by using the Puppy Event Manager -> Save Session

pmedia=usbhd. But this time it took less than 5 seconds for puppy to shutdown.

This tells Puppy that it is installed on a device that writing to does not need to be limited.
It is a hard drive.
Puppy boots in pupmode 12
The save is mounted read/write and directly written to as stuff changes.
No save ram disk.
When you shutdown.
The save is already updated, so no need to add anything to it.

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
mr_gs
Posts: 38
Joined: Tue Dec 14, 2021 6:39 am
Has thanked: 7 times
Been thanked: 8 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by mr_gs »

Yeah what you said is exactly write.
Pmedia=usbflash creates a tmpfs in ram and the data is written to flash drive only on shutdown or when clicking the save2flash icon in desktop.
Pmedia=usbhd writes the data to the disk immediately.

What I meant in the post is:
Consider that I already have a file (1GB), in a folder. I copied the file to another directory/renamed it. I could see that 1GB of space in the tmpfs is used(from conky-my RAM is 4GB, so tmpfs has a size of 2GB). It took a lot of time to shutdown (I don't think renaming/moving a file to another folder in the same partition takes long time).

As far I as know, in ext4 filesystem, when we move a file (in the same partition) or rename a file, the changes are made only to index of the filesystem. i.e. When we rename a file, rather than copying the same stuff with a new name, it just updates the path of the file in the index of filesystem. When we delete a file, the index is deleted but contents are not deleted.(so we are able to recover deleted data).

In case of copying, I agree that it takes time because the system takes a copy of the file to another location.

If I make a small change(rename or move) to a big file that already exists on my flash drive (not tmpfs), will puppy writes the whole file or just update the filesystem index?

Fossapup 9.5 64bit Kernel 5.4.53
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
8GB RAM
Intel (R) UHD Graphics

TerryH
Posts: 578
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 111 times
Been thanked: 131 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by TerryH »

mr_gs wrote: Sun Mar 27, 2022 2:25 am

Yeah what you said is exactly write.
Pmedia=usbflash creates a tmpfs in ram and the data is written to flash drive only on shutdown or when clicking the save2flash icon in desktop.
Pmedia=usbhd writes the data to the disk immediately.

What I meant in the post is:
Consider that I already have a file (1GB), in a folder. I copied the file to another directory/renamed it. I could see that 1GB of space in the tmpfs is used(from conky-my RAM is 4GB, so tmpfs has a size of 2GB). It took a lot of time to shutdown (I don't think renaming/moving a file to another folder in the same partition takes long time).

As far I as know, in ext4 filesystem, when we move a file (in the same partition) or rename a file, the changes are made only to index of the filesystem. i.e. When we rename a file, rather than copying the same stuff with a new name, it just updates the path of the file in the index of filesystem. When we delete a file, the index is deleted but contents are not deleted.(so we are able to recover deleted data).

In case of copying, I agree that it takes time because the system takes a copy of the file to another location.

If I make a small change(rename or move) to a big file that already exists on my flash drive (not tmpfs), will puppy writes the whole file or just update the filesystem index?

I believe that flash based file systems don't work this way, the index can't just be updated like this. The file has to be rewritten. Someone with a more technical knowledge may be able to explain it better, so I'll won't try.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

williams2
Posts: 1026
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 291 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by williams2 »

As far I as know, in ext4 filesystem, when we move a file (in the same partition) or rename a file, the changes are made only to index of the filesystem.

This is true, only if the renamed files or directories are in the same file system.
(in all Linux distros, not just Puppy.)

For example, if you move a file from /root/ to /mnt/home/
if /root/ is in a tmpfs file system
and if /mnt/home/ is in an ext2,3,4 or vfat or ntfs file system,
then you can not move the file by just altering the meta data.
Moving a file requires copying the file to the destination's file system
(before copying, the data in the file is not in the destination's file system)
then deleting the file from the original file system.

In Puppy, each layer of the aufs layered file system, is a different file system.
Moving a file from one file system to another always requires copying the data in the file.

User avatar
mr_gs
Posts: 38
Joined: Tue Dec 14, 2021 6:39 am
Has thanked: 7 times
Been thanked: 8 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by mr_gs »

williams2 wrote: Sun Mar 27, 2022 4:27 am

In Puppy, each layer of the aufs layered file system, is a different file system.
Moving a file from one file system to another always requires copying the data in the file.

Thanks. This clarified my doubt. :thumbup:

Fossapup 9.5 64bit Kernel 5.4.53
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
8GB RAM
Intel (R) UHD Graphics

User avatar
glene77is
Posts: 52
Joined: Thu Aug 13, 2020 7:44 pm
Location: Univ of TN, Memphis,TN,USA
Has thanked: 39 times
Been thanked: 6 times
Contact:

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by glene77is »

Guys,
We use several USB flashdrives, 256G Bytes.
We make super use of 256GigByte Flash Drives for long term storage, with frequent updates.

In order to reduce the quantity of re-writes,
....... we always append a DTS (Date-Time-Seconds) number to the end of each BIG file we write.

In order to reduce the quantity of re-writes,
....... we never delete the old file. The filename(with DTS) prevents over-writes.

Thus, the new write filename(with DTS) can be written one time, and may remain for months,
... not interferring with any old writes filename(with DTS).

The old filename(with DTS) can sit there for many months
....... there are many GigaBytes of free space remaining on a 256GB Flashdrive.
These old writes of filename(with DTS) can stack up and remain for a long time.
....... the computer does not care if we let old files 'linger' on the USB chip.

The filename(with DTS) prevents overwriting, and eliminates almost all deletions.

Our copies always write to a fresh part of the USB flashdrive.
Once a year, we might delete a few of the old filename(with DTS) to free up some USB chip space. Maybe once a year.

This method has allowed us to use large USB flashdrives for storage for data ... some are ten years old.

caveat:
We had one overheat on a 100 GigaByte write
and give faults.
So now, for BIG writes, we make sure these USB are on a dongle, over the computer fan.

Hope that helps you make super use of 256GigByte Flash Drives for long term storage, with frequent updates.
...

*Just an old Apprentice caught Tinkering in the Master's WorkShop. *
Glen Ellis ( ͡° ͜ʖ ͡° ) K4KKQ , Electronic Engineering :ugeek:
Website: http://www.GeoCities.WS/glene77is :thumbup2:
Electrical Science , Memphis, TN

sonny
Posts: 604
Joined: Mon Feb 15, 2021 4:50 pm
Has thanked: 442 times
Been thanked: 141 times

Re: Does pmedia=usbflash for a usb pendrive saves it's writecycle?

Post by sonny »

FLASH, in my opinion, is not "optimized" for STORAGE. Hard Disk Drive is.
I use SSD & USB flash only for o/s and apps. Things that I "create/edit/save/remove" are ALWAYS in mechanical media (and backed up in the cloud).
That's why I firmly believe that
1. Puppy Linux is the BEST for flash (minimum write on the media)
2. F2FS is the BEST system for flash (optimized for flash media)
3. SAMSUNG brand is the BEST for F2FS (major flash media manufacturer & F2FS originator)

Post Reply

Return to “Fossapup64”