linux
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux [2020/05/11 13:15] – felixonmars | linux [2024/05/13 17:38] (current) – [Mount Target System For Chroot] felixonmars | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Create a Swap File ==== | ==== Create a Swap File ==== | ||
| < | < | ||
| - | SWAPFILE=/swapfile1 | + | _size=4g |
| - | dd if=/dev/zero of=$SWAPFILE bs=1024 count=1048576 | + | _location=/ |
| - | mkswap | + | fallocate -l $_size $_location/$_size.swap |
| - | chown root: | + | chmod 600 $_location/$_size.swap |
| - | chmod 0600 $SWAPFILE | + | mkswap $_location/$_size.swap |
| - | swapon | + | echo "$_location/ |
| + | swapon | ||
| </ | </ | ||
| - | === Add to /etc/fstab to make it persistent === | + | btrfs: |
| < | < | ||
| - | echo "$SWAPFILE none swap sw 0 0" >> | + | btrfs filesystem mkswapfile -s $_size $_location/$_size.swap |
| </ | </ | ||
| ==== Mount Target System For Chroot ==== | ==== Mount Target System For Chroot ==== | ||
| < | < | ||
| - | TARGET=/mnt | + | _target=/mnt |
| - | mount /dev/sdxn $TARGET | + | mount -t proc proc $_target/proc |
| - | mount -t proc proc $TARGET/proc | + | mount -t sysfs sys $_target/sys |
| - | mount -t sysfs sys $TARGET/sys | + | mount -o bind /dev $_target/dev |
| - | mount -o bind /dev $TARGET/dev | + | mount -t devpts pts $_target/dev/pts/ |
| - | mount -t devpts pts $TARGET/dev/pts/ | + | chroot $_target |
| - | chroot $TARGET | + | </ |
| + | |||
| + | ==== ZSWAP ==== | ||
| + | Configuration: | ||
| + | < | ||
| + | grep -r . / | ||
| + | </ | ||
| + | Stats: | ||
| + | < | ||
| + | grep -r . / | ||
| </ | </ | ||
linux.1589202927.txt.gz · Last modified: 2020/05/11 13:15 by felixonmars
