'잡동사니'에 해당되는 글 13813건

  1. 2024.02.15 btrfs CoW
  2. 2024.02.15 statvfs() 의 f_bavail과 f_bfree 차이
  3. 2024.02.15 db 식별/비식별 관계
  4. 2024.02.15 golang runtime.GOMAXPROCS()
  5. 2024.02.14 golang echo 템플릿 파일로 불러오기
  6. 2024.02.13 flipper zero
  7. 2024.02.13 소득공제?
  8. 2024.02.13 libreoffice에서 italic으로 자동 변환 막기
  9. 2024.02.13 btrfs fsck
  10. 2024.02.12 피곤모드
Linux API/linux2024. 2. 15. 18:13

장점일수도 있고 위험요소일수도 있는 부분 같은데

Btrfs 에서 파일을 복사하면 CoW 로 작동하게 된다.

물론 inode도 다르고 전혀 다른 파일이지만 수정 하기 전까지는 공간을 차지 하지 않는데

수정하는 순간 대용량 파일이라면 갑자기 용량을 먹어 버리는데

전체 스토리지를 넘길 경우에는 어떻게 작동하려나?

 

해당 기능을 끄면 checksum도 끈다는 먼가 무시무시한 경고가 보인다.

Disabling CoW
Warning: Disabling CoW in Btrfs also disables checksums. Btrfs will not be able to detect corrupted nodatacow files. When combined with RAID 1, power outages or other sources of corruption can cause the data to become out of sync.
To disable copy-on-write for newly created files in a mounted subvolume, use the nodatacow mount option. This will only affect newly created files. Copy-on-write will still happen for existing files. The nodatacow option also disables compression. See btrfs(5) for details.

[링크 : https://wiki.archlinux.org/title/btrfs]

'Linux API > linux' 카테고리의 다른 글

usb hid, hidraw  (0) 2024.03.11
linux 멀티터치 프로토콜  (0) 2024.03.08
statvfs() 의 f_bavail과 f_bfree 차이  (0) 2024.02.15
corrupted size vs. prev_size 에러.. part2  (0) 2023.12.15
리눅스 커널 6.6.6 릴리즈  (0) 2023.12.13
Posted by 구차니
Linux API/linux2024. 2. 15. 17:42

해당 함수의 리턴은 아래 구조체를 사용하는데

f_blocks / f_bfree / f_bavail 로 구성되고

free와 available 이라는 미묘~하게 겹치는 비슷한 의미를 지닌 단어로 지칭되는 변수가 두개가 존재한다.

           struct statvfs {
               unsigned long  f_bsize;    /* Filesystem block size */
               unsigned long  f_frsize;   /* Fragment size */
               fsblkcnt_t     f_blocks;   /* Size of fs in f_frsize units */
               fsblkcnt_t     f_bfree;    /* Number of free blocks */
               fsblkcnt_t     f_bavail;   /* Number of free blocks for unprivileged users */
               fsfilcnt_t     f_files;    /* Number of inodes */
               fsfilcnt_t     f_ffree;    /* Number of free inodes */
               fsfilcnt_t     f_favail;   /* Number of free inodes for nprivileged users */
               unsigned long  f_fsid;     /* Filesystem ID */
               unsigned long  f_flag;     /* Mount flags */
               unsigned long  f_namemax;  /* Maximum filename length */
           };

[링크 : https://blog.naver.com/gauya/220573174198]

 

간단하게 프로그램을 짜서 실행해보면

#include <sys/statvfs.h>
#include <stdio.h>

int main() {
struct statvfs sv;
statvfs("/app/data",&sv);

long total, usabe;
double frate;

total = ((long long)sv.f_blocks * sv.f_bsize / 1024);
usabe = ((long long)sv.f_bavail * sv.f_bsize / 1024);
frate = ((double)sv.f_bavail * 100.) / (double)sv.f_blocks;

printf("%ld %ld %ld\n",
sv.f_blocks,
sv.f_bavail,
sv.f_bfree);

printf("%ld %ld %.1f\n", total, usabe, frate);
printf("%f\n",(sv.f_blocks - sv.f_bavail) * 100.0 / sv.f_blocks);
}

 

아래와 같이 나오는데

# df;./arm.o 
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/mmcblk2p9  50500092 1322852  46579560   3% /app/data
12625023 11644890 12294310
50500092 46579560 92.2
7.763416

 

값을 4k block -> 1k block 으로 변환해서 계산하면 아래와 같이 block / avail / free 값이 나온다.

df 의 used는 block - avail이 아니라 block - free 용량이라..

blocks avail free
12,625,023 11,644,890 12,294,310
50,500,092 46,579,560 49,177,240
  3,920,532 (block - avail) 1,322,852 (block - free)

 

그럼 avail과 free는 무슨 차이일까? 저기.. unprivileged users의 의미가 도대체 멀까...

               fsblkcnt_t     f_blocks;   /* Size of fs in f_frsize units */
               fsblkcnt_t     f_bfree;    /* Number of free blocks */
               fsblkcnt_t     f_bavail;   /* Number of free blocks for unprivileged users */

'Linux API > linux' 카테고리의 다른 글

linux 멀티터치 프로토콜  (0) 2024.03.08
btrfs CoW  (0) 2024.02.15
corrupted size vs. prev_size 에러.. part2  (0) 2023.12.15
리눅스 커널 6.6.6 릴리즈  (0) 2023.12.13
mmap() 과 munmap() 예제  (0) 2023.11.17
Posted by 구차니

대부분 외래키로 배워와서.. 비식별 관계로 하면 되는구나..

그런데 식별관계 처럼 쓰는 경우는 도대체 머지? 감이 안온다.

식별관계 - 부모 테이블의 기본키/유니크 키를 자식 테이블의 기본키로 사용하는 관계
비식별 관계 -  부모 테이블의 기본키/유니크 키를 외래 키로 사용하는 관계

[링크 : https://deveric.tistory.com/108]

 

erdcloud 사용법 관련

[링크 : https://inpa.tistory.com/entry/ERD-CLOUD-☁%EF%B8%8F-ERD-다이어그램을-온라인에서-그려보자]

[링크 : https://blog.naver.com/sssang97/222808912681]

[링크 : https://velog.io/@lkm021/database007]

'이론 관련 > 컴퓨터 관련' 카테고리의 다른 글

1.58bit  (0) 2024.03.16
gps kalman  (0) 2024.03.13
vRAN  (0) 2023.08.23
cordic (coordinate rotation digital computer)  (0) 2023.02.27
tlv  (0) 2022.10.19
Posted by 구차니
Programming/golang2024. 2. 15. 09:22

golang은 1개 cpu만 쓰도록 되어 있다는데

요즘 버전에서는 어떻게 바뀌었나 확인은 필요할 것 같다.

 

해보니 전체 코어 갯수 만큼 돌리도록 설정되는 듯. (go 1.20.4에서 테스트)

func GOMAXPROCS ¶
func GOMAXPROCS(n int) int
GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously and returns the previous setting. It defaults to the value of runtime.NumCPU. If n < 1, it does not change the current setting. This call will go away when the scheduler improves.

func

 

 

[링크 : https://pkg.go.dev/runtime#NumCPU]

[링크 : https://pkg.go.dev/runtime#GOMAXPROCS]

 

[링크 : https://pyrasis.com/book/GoForTheReallyImpatient/Unit33/01]

 

 

'Programming > golang' 카테고리의 다른 글

golang package  (0) 2024.02.19
golang html/template ParseFiles()  (0) 2024.02.16
golang echo 템플릿 파일로 불러오기  (0) 2024.02.14
golang switch  (0) 2024.02.08
golang switch - fallthrough  (0) 2024.02.08
Posted by 구차니
Programming/golang2024. 2. 14. 18:06

"html/template" 를 이용하여 구현하면 된다.

echo도 html을 쓴걸로 아는데 template까지는 안끌어왔나?

 

[링크 : https://dev.to/ykyuen/setup-nested-html-template-in-go-echo-web-framework-e9b]

[링크 : https://gitlab.com/ykyuen/golang-echo-template-example/]

'Programming > golang' 카테고리의 다른 글

golang html/template ParseFiles()  (0) 2024.02.16
golang runtime.GOMAXPROCS()  (0) 2024.02.15
golang switch  (0) 2024.02.08
golang switch - fallthrough  (0) 2024.02.08
golang break, continue 라벨 그리고 goto  (0) 2024.02.08
Posted by 구차니
파일방2024. 2. 13. 15:37

이런걸 만들어서 팔다니 대박 -_-

[링크 : https://flipperzero.one/]

[링크 : https://gigglehd.com/gg/mobile/15561065]

 

나름 디자인도 잘 뽑혀 나왔고

가격이 165$. 환율 고려하면 20만원 정도 하긴 한데

저렇게 컴팩트 하게 기능이 다 있는거면, 직접 만들바에는 사는것도 나쁘지 않겠다 싶을 정도

[링크 : https://lab401.com/products/flipper-zero]

 

SPI 로 된 sub 1GHz transceiver 요게 RF의 핵심인 듯

Ultra low-power wireless applications operating in the 315/433/868/915 MHz ISM/SRD bands


[링크 : https://www.ti.com/lit/ds/symlink/cc1101.pdf]

[링크 : https://github.com/flipperdevices/flipperzero-firmware/pull/2747]

'파일방' 카테고리의 다른 글

untangle  (0) 2024.03.11
ventoy  (0) 2024.03.09
bytran - hitran 시뮬레이터?  (0) 2023.08.21
kchmviewer  (0) 2023.06.14
barrier - fork of synergy  (0) 2023.01.02
Posted by 구차니

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

ㄹ미ㅏㄴ어리ㅏㅁㄴ어리ㅏㄴㅁ어리ㅏ  (0) 2024.03.06
소득공제 공부 ㅠ  (0) 2024.02.29
으아아아아아  (0) 2024.01.24
개 피곤  (0) 2024.01.12
일이 안풀린다  (0) 2023.11.23
Posted by 구차니

calc에서 url 치는데 자꾸 italic 으로 기울여 쓰기 해서

검색해보니 자동고침에서  /문자열/ 의 경우 자동으로 바꾼다고..

리눅스 개발자도 좀 배려해달라!

[링크 : https://ask.libreoffice.org/t/lo-changing-text-to-italics/61544]

'프로그램 사용 > openoffice' 카테고리의 다른 글

libreoffice impress 색상 바꾸기(반전)  (0) 2024.12.17
libreoffice calc 빈 열 삭제하기  (0) 2024.08.02
libreoffice hwp 확장  (0) 2023.10.11
libreoffice calc 중복제거  (0) 2023.08.05
libreoffice OpenCL 적용하기  (0) 2023.08.04
Posted by 구차니
Linux2024. 2. 13. 10:20

btrfs는 fsck로 체크 못하고, btrfs 유틸리티의 check 명령을 통해서 확인해야 한다.

# fsck /dev/mmcblk2p9
fsck from util-linux 2.37.4
If you wish to check the consistency of a BTRFS filesystem or
repair a damaged filesystem, see btrfs(8) subcommand 'check'.

# btrfs
btrfs               btrfs-convert       btrfs-find-root     btrfs-image         btrfs-map-logical   btrfs-select-super  btrfsck             btrfstune           

# btrfs check /dev/mmcblk2p9
Opening filesystem to check...
Checking filesystem on /dev/mmcblk2p9
UUID: a6226cd4-fc4e-4e20-8861-5870feefb3da
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 12189671424 bytes used, no error found
total csum bytes: 11890008
total tree bytes: 14303232
total fs tree bytes: 180224
total extent tree bytes: 229376
btree space waste bytes: 1957387
file data blocks allocated: 12175368192
 referenced 12171370496

 

man은 안되서 --help를 보는데 내용이 부실하긴 하다. restore와 rescue는 어떨 때 쓸 수 있으려나?

# btrfs --help
usage: btrfs [--help] [--version] [--format <format>] [-v|--verbose] [-q|--quiet] <group> [<group>...] <command> [<args>]

    btrfs balance start [options] <path>
        Balance chunks across the devices
    btrfs balance pause <path>
        Pause running balance
    btrfs balance cancel <path>
        Cancel running or paused balance
    btrfs balance resume <path>
        Resume interrupted balance
    btrfs balance status [-v] <path>
        Show status of running or paused balance

    btrfs check [options] <device>
        Check structural integrity of a filesystem (unmounted).

    btrfs device add [options] <device> [<device>...] <path>
        Add one or more devices to a mounted filesystem.
    btrfs device delete <device>|<devid> [<device>|<devid>...] <path>
    btrfs device remove <device>|<devid> [<device>|<devid>...] <path>
        Remove a device from a filesystem
    btrfs device scan [-d|--all-devices] <device> [<device>...]
    btrfs device scan -u|--forget [<device>...]
        Scan or forget (unregister) devices of btrfs filesystems
    btrfs device ready <device>
        Check and wait until a group of devices of a filesystem is ready for mount
    btrfs device stats [options] <path>|<device>
        Show device IO error statistics
    btrfs device usage [options] <path> [<path>..]
        Show detailed information about internal allocations in devices.

    btrfs filesystem df [options] <path>
        Show space usage information for a mount point
    btrfs filesystem du [options] <path> [<path>..]
        Summarize disk usage of each file.
    btrfs filesystem show [options] [<path>|<uuid>|<device>|label]
        Show the structure of a filesystem
    btrfs filesystem sync <path>
        Force a sync on a filesystem
    btrfs filesystem defragment [options] <file>|<dir> [<file>|<dir>...]
        Defragment a file or a directory
    btrfs filesystem resize [options] [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path>
        Resize a filesystem
    btrfs filesystem label [<device>|<mount_point>] [<newlabel>]
        Get or change the label of a filesystem
    btrfs filesystem usage [options] <path> [<path>..]
        Show detailed information about internal filesystem usage .

    btrfs inspect-internal inode-resolve [-v] <inode> <path>
        Get file system paths for the given inode
    btrfs inspect-internal logical-resolve [-Pvo] [-s bufsize] <logical> <path>
        Get file system paths for the given logical address
    btrfs inspect-internal subvolid-resolve <subvolid> <path>
        Get file system paths for the given subvolume ID.
    btrfs inspect-internal rootid <path>
        Get tree ID of the containing subvolume of path.
    btrfs inspect-internal min-dev-size [options] <path>
        Get the minimum size the device can be shrunk to
    btrfs inspect-internal dump-tree [options] <device> [<device> ..]
        Dump tree structures from a given device
    btrfs inspect-internal dump-super [options] device [device...]
        Dump superblock from a device in a textual form
    btrfs inspect-internal tree-stats [options] <device>
        Print various stats for trees

    btrfs property get [-t <type>] <object> [<name>]
        Get a property value of a btrfs object
    btrfs property set [-f] [-t <type>] <object> <name> <value>
        Set a property on a btrfs object
    btrfs property list [-t <type>] <object>
        Lists available properties with their descriptions for the given object

    btrfs qgroup assign [options] <src> <dst> <path>
        Assign SRC as the child qgroup of DST
    btrfs qgroup remove [options] <src> <dst> <path>
        Remove a child qgroup SRC from DST.
    btrfs qgroup create <qgroupid> <path>
        Create a subvolume quota group.
    btrfs qgroup destroy <qgroupid> <path>
        Destroy a quota group.
    btrfs qgroup show [options] <path>
        Show subvolume quota groups.
    btrfs qgroup limit [options] <size>|none [<qgroupid>] <path>
        Set the limits a subvolume quota group.

    btrfs quota enable <path>
        Enable subvolume quota support for a filesystem.
    btrfs quota disable <path>
        Disable subvolume quota support for a filesystem.
    btrfs quota rescan [-sw] <path>
        Trash all qgroup numbers and scan the metadata again with the current config.

    btrfs receive [options] <mount>
    btrfs receive --dump [options]
        Receive subvolumes from a stream

    btrfs replace start [-Bfr] <srcdev>|<devid> <targetdev> <mount_point>
        Replace device of a btrfs filesystem.
    btrfs replace status [-1] <mount_point>
        Print status and progress information of a running device replace operation
    btrfs replace cancel <mount_point>
        Cancel a running device replace operation.

    btrfs rescue chunk-recover [options] <device>
        Recover the chunk tree by scanning the devices one by one.
    btrfs rescue super-recover [options] <device>
        Recover bad superblocks from good copies
    btrfs rescue zero-log <device>
        Clear the tree log. Usable if it's corrupted and prevents mount.
    btrfs rescue fix-device-size <device>
        Re-align device and super block sizes. Usable if newer kernel refuse to mount it due to mismatch super size
    btrfs rescue create-control-device
        Create /dev/btrfs-control (see 'CONTROL DEVICE' in btrfs(5))
    btrfs rescue clear-uuid-tree
        Delete uuid tree so that kernel can rebuild it at mount time

    btrfs restore [options] <device> <path>
    btrfs restore [options] -l <device>
        Try to restore files from a damaged filesystem (unmounted)

    btrfs scrub start [-BdqrRf] [-c ioprio_class -n ioprio_classdata] <path>|<device>
        Start a new scrub. If a scrub is already running, the new one fails.
    btrfs scrub cancel <path>|<device>
        Cancel a running scrub
    btrfs scrub resume [-BdqrR] [-c ioprio_class -n ioprio_classdata] <path>|<device>
        Resume previously canceled or interrupted scrub
    btrfs scrub status [-dR] <path>|<device>
        Show status of running or finished scrub

    btrfs send [-ve] [-p <parent>] [-c <clone-src>] [-f <outfile>] <subvol> [<subvol>...]
        Send the subvolume(s) to stdout.

    btrfs subvolume create [-i <qgroupid>] [<dest>/]<name>
        Create a subvolume
    btrfs subvolume delete [options] <subvolume> [<subvolume>...]
    btrfs subvolume delete [options] -i|--subvolid <subvolid> <path>
        Delete subvolume(s)
    btrfs subvolume list [options] <path>
        List subvolumes and snapshots in the filesystem.
    btrfs subvolume snapshot [-r] [-i <qgroupid>] <subvolume> { <subdir>/<name> | <subdir> }
        
    btrfs subvolume get-default <path>
        Get the default subvolume of a filesystem
    btrfs subvolume set-default <subvolume>
    btrfs subvolume set-default <subvolid> <path>
        Set the default subvolume of the filesystem mounted as default.
    btrfs subvolume find-new <path> <lastgen>
        List the recently modified files in a filesystem
    btrfs subvolume show [options] <path>
        Show more information about the subvolume (UUIDs, generations, times, snapshots)
    btrfs subvolume sync <path> [<subvol-id>...]
        Wait until given subvolume(s) are completely removed from the filesystem.

    btrfs help [--full] [--box]
        Display help information
    btrfs version
        Display btrfs-progs version

Use --help as an argument for information on a specific group or command.
Options for --format are: text, json

[링크 : https://www.nemonein.xyz/2019/12/2861/]

'Linux' 카테고리의 다른 글

lsusb -v 로 본 장치(HID MT, mouse)  (0) 2024.03.08
systemd 지연된 시작  (0) 2024.02.29
리눅스 파일 시스템 캐싱  (0) 2024.01.09
multitail / tail  (2) 2023.10.18
top 로그로 남기기  (0) 2023.10.17
Posted by 구차니

개 한놈은 산책가자고 얼굴 핥아대고

개 다른 한놈은 코로 문열고 들어와서 굴러 다니지도 못하게 하고 -_-

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

주말이 짧다  (0) 2024.02.25
으윽 비가 온다.  (0) 2024.02.18
애견놀이터 민원은 실패  (0) 2024.02.03
상병발생원인 신고서?  (2) 2024.02.02
온천 다녀옴  (0) 2024.01.28
Posted by 구차니