You are not logged in.

#1 2022-01-01 18:18:04

malacology
Member
Registered: 2021-04-24
Posts: 152

[solve] how to use fdisk to merge on partition into another paritition

# fdisk -l
Disk /dev/vda: 95 GiB, 102005473280 bytes, 199229440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb26758c8

Device     Boot     Start       End   Sectors  Size Id Type
/dev/vda1  *         2048 197134335 197132288   94G 83 Linux
/dev/vda2       197134336 199229439   2095104 1023M 82 Linux swap / Solaris


Disk /dev/loop0: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

# df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             983M     0  983M   0% /dev
run             991M  568K  990M   1% /run
/dev/vda1        93G   26G   62G  30% /
tmpfs           991M     0  991M   0% /dev/shm
tmpfs           199M  4.0K  199M   1% /run/user/0
tmpfs           199M  4.0K  199M   1% /run/user/1000
/dev/loop0      9.8G  148K  9.3G   1% /tmp

I want to merge /dev/loop0 into the /dev/vda1, but I can only delete the content of  /dev/loop0, what should I do

Last edited by malacology (2022-01-01 22:50:37)


Don't speak to silly man. Keep Minimalism.

Offline

#2 2022-01-01 18:31:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,493
Website

Re: [solve] how to use fdisk to merge on partition into another paritition

Ah ... what??  You can "merge" partitions on a single device (really just delete one and expand the other) but you can't merge devices.  This looks like an X-Y question: what are you really trying to do?  You can have partitions on separate devices that can be mounted together with unionfs or similar approaches ... this *might* relate to your actual goals.

Last edited by Trilby (2022-01-01 18:32:11)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-01-01 18:39:58

malacology
Member
Registered: 2021-04-24
Posts: 152

Re: [solve] how to use fdisk to merge on partition into another paritition

okay
I try to delte

# fdisk  /dev/loop0

Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.

The device contains 'ext3' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xea35b6f7.

Command (m for help): d
No partition is defined yet!

Command (m for help): p

Disk /dev/loop0: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xea35b6f7

Command (m for help): d :
No partition is defined yet!

Last edited by malacology (2022-01-01 18:45:03)


Don't speak to silly man. Keep Minimalism.

Offline

#4 2022-01-01 18:56:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,493
Website

Re: [solve] how to use fdisk to merge on partition into another paritition

So you read neither my post, nor the output from fdisk ... I'm not sure what else to put here if you aren't going to read anything.  Perhaps I could go find some pictures of cats.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-01-01 19:12:09

malacology
Member
Registered: 2021-04-24
Posts: 152

Re: [solve] how to use fdisk to merge on partition into another paritition

okay, I won't get any help on bbs now. Bye


Don't speak to silly man. Keep Minimalism.

Offline

#6 2022-01-01 19:29:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,493
Website

Re: [solve] how to use fdisk to merge on partition into another paritition

?u=http%3A%2F%2F2.bp.blogspot.com%2F_KhXyG8nRFYM%2FSi57ePi96OI%2FAAAAAAAAAQU%2Fhx0x_GMRlS4%2Fs320%2Fkthxbai.jpg&f=1&nofb=1


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2022-01-01 20:13:15

malacology
Member
Registered: 2021-04-24
Posts: 152

Re: [solve] how to use fdisk to merge on partition into another paritition

dd if=/temp-dsik > /dev/zero

the reason is that my command to create the /dev/loop0

dd if=/dev/zero of=/temp-disk bs=2M count=5120
mke2fs -j /temp-disk
umount /tmp
vim /etc/fstab

add

/temp-disk /tmp ext4 rw,noexec,nosuid,loop 0 0
mount -t ext4 -o rw,noexec,nosuid,loop /temp-disk /tmp
chmod 1777 /tmp

Last edited by malacology (2022-01-01 20:15:47)


Don't speak to silly man. Keep Minimalism.

Offline

#8 2022-01-01 22:38:57

teckk
Member
Registered: 2013-02-21
Posts: 588

Re: [solve] how to use fdisk to merge on partition into another paritition

I want to merge /dev/loop0 into the /dev/vda2

/dev/vda2       197134336 199229439   2095104 1023M 82 Linux swap / Solaris

/dev/vda2 is a swap partition, 1GB. You want to put the contents of /dev/loop0 into the swap partition? Or you want to replace the swap partition with the contents of /dev/vda2? /dev/loop0 is 9.8GB.

/dev/loop0 is read only isn't it? You could make an .iso out of /dev/vda2 if you have space to store it. Depends on what loop0 is. Virtual machine?

dd if=/dev/vda2 of=myfile.iso bs=2048

You can then write that to somewhere.

dd if=/temp-dsik > /dev/zero

Do you have a directory under / named temp-dsik? Or do you mean /home/<user>/temp-dsik? That redirects the contents to /dev/zero.

dd if=/dev/zero of=/temp-disk bs=2M count=5120

That writes zeros to the first 10240000000 of /temp-disk, if that actually exists.

If you are wanting to replace /dev/vda2, you can. You could delete it, or put an ext3/4 file system in it. Since it is a swap partition, you probably want to remove the reference in fstab to it. But it is only 1GB.

Offline

#9 2022-01-01 22:51:37

malacology
Member
Registered: 2021-04-24
Posts: 152

Re: [solve] how to use fdisk to merge on partition into another paritition

so sorry, I write mistakenly, sda1, I have /temp-disk


Don't speak to silly man. Keep Minimalism.

Offline

Board footer

Powered by FluxBB